Forum Moderators: phranque
[edited by: phranque at 1:26 pm (utc) on Mar 12, 2014]
[edit reason] Please Use example.com [webmasterworld.com] [/edit]
DirectoryIndex home.html DirectoryIndex home.html index.html index.php When I browse to http://www.example.com I want to be redirected to http://www.example.com/home.html
When I browse to http://www.example.com/index.php I want to be redirected to http://www.example.com/index.php
DirectoryIndex filename.html DirectoryIndex index.html index.php filename.html If your quoted rule worked-- it doesn't and can't-- it would mean: people who go to
www.example.com/subdirectory/
are shown the content of
www.example.com/filename.html
I kinda thought that the DirectoryIndex was basically a redirect.
RewriteRule ^subdirectory/mystyles.css http://www.example.com/mystyles.css [L] ^subdirectory(image1|image2)\.jpg RewriteCond %{THE_REQUEST} filename\.html
RewriteRule ^filename\.html http://www.example.com/subdirectory/ [R=301,L]
If a solution for this problem doesn't exist, it really should! Surely there are times when you want to send the user to a different page in a different directory, as if they actually typed in that page address.
RewriteRule ^subdirectory/mystyles.css http://www.example.com/mystyles.css [L]
^subdirectory(image1|image2)\.jpg
^subdirectory/(image1|image2)\.jpg
The solution is to code the links to the css, js and images with a leading slash so that no matter where the HTML file is on the server and no matter what URL you use to read that file, the links will point to an absolute place and not to someplace relative to the URL that was requested by the browser.