I'm developing a really small site, 5 pages, in php on apache. I have produced 5 php files within the top directory, index.php, random.php, etc. I needed to cover the .php extension, and so i place the following into my .htaccess:
RewriteRule ^random/?$ random.php
Basically visit www.example.com/random I recieve the page I desired, but when I visit www.example.com/random/ (slash in the finish), the css and links are one directory lower, i.e. the server thinks I'm in /random/index.php, not at /random.php.
I am a total noob at RewriteRule, so thanks ahead of time!
You ought to have another rule for that trailing slash that really does an HTTP redirect. eg:
RewriteRule ^random/$ /random [R=301,L] RewriteRule ^random$ random.php
Relative Web addresses are addressed by the browser, so with this trailing slash the browser can get confused.
Most HTTP servers really perform the inverse of the kind of redirect for directory names. That's, if put forth
bar is really a directory, you will be rerouted to