In a content management system written in PHP, I have an .htacces file with this Mod Rewrite configuration:
- Code: Select all
Options + FollowSymLinks
RewriteEngine On
RewriteCond %(SCRIPT_FILENAME)!-f
RewriteCond %(SCRIPT_FILENAME)!-f
RewriteRule ^(.*)$ resolv.php [L]
The purpose is to catch in resolv.php the requests for nonexistent files or directories.
If, for example, a user makes a request to this URL:
http://example.com/cms/inexistent
everything works fine. Mod Rewrite loads the file http://example.com/cms/resolv.php, and then a friendly 404 page is shown.
But if the requested URL is:
http://example.com/cms/ine/xis/tent
then I have a problem. Mod Rewrite loads http://example.com/cms/resolv.php file, which is what I want, but in the friendly 404 page, the BASE URI of the HTML becomes http://example.com/cms/ine/xis/ and then, soft referenced images and links stop working.
The question is:
Can Mod Rewrite be configured in a form in wich the BASE URI becomes the same of resolv.php in case the user request for a nonexistent directory or a file in a nonexistent directory?
Thanks.