Forum Moderators: phranque
My host doesn't seem to have this.
When a link is clicked with [mydomain...] I get a 400 bad request error.
This a bad because Yahoo has lots of my default index pages listed this way.
Is there a way I can fix this, to corectly redirect to my index, using .htaccess?
Thanks
[mydomain.com...]
Every directory I have has an index page which isn't found without the trailing slash.
I searched around and found out about mod_dir, which explains my problem.
I tried putting DirectoryIndex index.html in the .htaccess but it made no difference.
If you have any possible solution please let me know.
Thanks
There's another solution using mod_rewrite, but you shouldn't use it unless you absolutely can't get mod_dir enabled properly. It's not very efficient compared to mod_dir, but this should work:
Options +FollowSymLinks
RewriteEngine on
# If REQUEST_URI does NOT(contain a period or end with a slash)
RewriteCond %{REQUEST_URI} !(\.¦/$)
# and it exists as a directory when translated to a server filepath with a slash appended
RewriteCond %{REQUEST_FILENAME}/ -d
# then redirect requested URI after adding a trailing slash
RewriteRule (.*) http://www.example.com/$1/ [R=301,L]
Jim