poisa
asked on
mod_rewrite url for everything except 1) real files, and 2) specific extensions like .js, .jpg, etc
I want to route everything to my controller index.php. So far so good. Now my problem is that if I link to a resource that doesn't exist like "http://domain.com/somefile.js", my system will route this through index.php thinking it's a valid URL when what I really want is to get a 404 for specific file types.
This is what I have (see code box below). And I want to prevent js, png, jpg, gif, mp3, swf files from getting rewritten.
Any ideas?
This is what I have (see code box below). And I want to prevent js, png, jpg, gif, mp3, swf files from getting rewritten.
Any ideas?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Rick,
There shouldn't be a space between the ! and the rest of the regexp. I fixed that and everything worked perfectly!
Thanks!
There shouldn't be a space between the ! and the rest of the regexp. I fixed that and everything worked perfectly!
Thanks!
Use this condition
RewriteCond /home/httpd/html/%{REQUEST
if your document root is /home/httpd/html/
Use this condition
RewriteCond /home/httpd/htdocs/%{REQUE
if your document root is /home/httpd/htdocs/