Forum Moderators: phranque
I'm trying to write some simple Rewrite rules to redirect visitors from, for example, www.example.com/test/page/sample to www.example.com/test/page.php?p=sample
Here are the contents of .htaccess file:
RewriteEngine on RewriteBase /test/ RewriteRule ^page/([0-z]*)/?$ page.php?p=$1 The redirect works, php files opens. The problem is no images, backgrounds and css styles are diplayed. They are in /test/style/ folder (all works fine without .htaccess). How can i solve this?
Thanks in advance, vilkspilks
The key is that it is the client (e.g. browser or robot) that resolves relative links, based upon where it "thinks" the referring page is located. In this case, the browser thinks we are in a subdirectory called "page" and will form canonical URLs by prepending "http://example.com/page/" to all page-relative links.
You can see the problem by looking at your server error log, and seeing how the image filepaths differ from the actual correct filepaths.
Jim