Hi Jim,
I read through the different threads concerning 301 redirects. I would like to use the staple examples I saw posted here:
Apache redirect /index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
Apache redirect example.com to www.example.com
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Couple of quick newbie questions:
1. I believe it was suggested to put the index redirect first, is that correct? And if so, is that because it is the more specific rule or is it for another reason (just curious)?
2. In the {THE_REQUEST} sample code (to redirect "/index.html" to "/"), do I need to insert a [NC] at the end to cover both "index.html" and "Index.html"?
3. I noticed in some other posts discussing redirecting example.com to www.example.com that instead of redirecting example.com to www.example.com, the code seemed to redirect everything that was not www.example.com to www.example.com, as in:
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]
While "stranger" to look at, I guess this is preferred in terms of optimization?
4. I have an old fashioned location.replace redirect in place to redirect "Index.html" to "/" (i.e. index.html). I guess there's no harm/conflict in keeping this old fashioned redirect file (Index.html) on the server?
Thanks a bunch,
HP