Forum Moderators: phranque
I am having trouble with .htaccess. when i upload it to my server and then view my site it just hangs...the code is below, any ideas folks?
Redirect 301 /index.html [mysite.com...]
Thank you in advance
RedirectMatch permanent ^/index.html$ [mysite.com...]
You can substitute temporary for permanent if you wish to. You don't have to put 301, it's understood.
John
If you have access to mod_rewrite, the problem can be fixed in your top-level .htaccess file like so:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
If you do not have mod_rewrite permissions, then another fix is to rename index.html to something else, such as "homepage.html" and then modify or add a DirectoryIndex directive to your .htaccess file:
DirectoryIndex homepage.html
Jim
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
Jim,
Please would you explain why it needs the "-MultiViews"? I haven't seen that used in mod_rewrite previously.
TIA.
Surprisingly, many shared hosts enable multiviews, and recently we've had several cases where it interfered with rewrites such as "extensionless files" and a few other things. See the mod_negotiation documentation at apache.org for more details.
Jim