I’m using codeigniter and .htaccess rewriting. Currently it’s rewriting all non-existing file queries to index.php(CodeIgniter), like so:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
Now i’d like like to rewrite urls beginning with “images” to “application/images” if file doesn’t exist. Something like this:
RewriteCond %{REQUEST_URI} ^/images
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ./application/$1 [L]
Well, that works in root directory, but not in subdirectory.
I do not want to add subdirectory name to htaccess, i’d like it to be dynamic. So if i’ll make copy of this dir, and rename it, i dont want to change my htaccet to this dir.
RewriteRule is relative to the directory im working but RewriteCond is not? Thanks in advance 🙂
Problem is solved by this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(images|js|css)(.*)$ ./application/$1$2 [L]
1 Answer