views:

41

answers:

1

I want to point to a sub directory file if it exists.

Currently I have in an .htaccess file at the webroot:

RewriteCond my_sub_dir/%{REQUEST_FILENAME} -d
RewriteRule ^.*$ my_sub_dir/%{REQUEST_FILENAME} [L]

Basically I want http://example.com/js/application.js to point to my_sub_dir/js/application.js if it exists

A: 

-d tests if the given path is a valid path to an existing directory. If you want to test for regular files, use -f instead. But you also need to provide an absolute filesystem path. So try this:

RewriteCond %{DOCUMENT_ROOT}/my_sub_dir%{REQUEST_URI} -f
RewriteRule ^ %{DOCUMENT_ROOT}/my_sub_dir%{REQUEST_URI} [L]
Gumbo
changed it up, it didn't fix it. I had the -f anyways (mis-typing). I don't seem to get an absolute system path for this though. I get an absolute path from the VirtualDirectory DocumentRoot.
buck