Forum Moderators: phranque

Message Too Old, No Replies

redirect /index not entire directory

         

ads112001

2:06 pm on Feb 3, 2011 (gmt 0)

10+ Year Member



I'd like to do a redirect in my htaccess. I want to redirect mysite.com/ to mysite.com/index-mobile.html but i only want to redirect mysite.com/index.html and not every file within the root directory. Any thoughts?

g1smd

11:40 pm on Feb 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is bad form to redirect TO a named index file.

Instead leave the URL as www.example.com/ by changing the DirectoryIndex directive to:

DirectoryIndex index-mobile.html


Link only to
www.example.com/
and not to a named index file.

Additionally, set up a 301 redirect such that when
(www.)example.com/index.html
is requested by a client, users are redirected to
www.example.com/
and the content is served at that URL.