Forum Moderators: phranque
I have been trying to do this on my own for 2 hours now but I can't come to a conclusion that makes me feel 100% sure that it is correct and SE friendly. I also wanted to make sure I did as much as possible before I came here for help.
I have 2 domain names, both identical except one is plural.
I want mydomain.com to redirect permanently to mydomains.com, so in mydomain.com, I put the following htaccess:
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.mydomain.com
AuthUserFile /home/mydomainusername/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/mydomainusername/public_html/_vti_pvt/service.grp
RewriteEngine on
RewriteRule (.*) http://www.mydomains.com/$1 [R=301,L]
For mydomains.com, I would like to have the site SE friendly by having all requests for [mydomains.com...] redirect to [mydomains.com...]
I would also like all request for the /index to go to the /forums/ temporarily. This leaves me the option of creating an index in the future if I choose to without disrupting the forums. So, I put the following htaccess:
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.mydomains.com
AuthUserFile /home/mydomainsusername/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/mydomainsusername/public_html/_vti_pvt/service.grp
RewriteEngine On
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.mydomains\.com [NC]
RewriteRule (.*) http://www.mydomains.com/$1 [R=301,L]
RedirectTemp /index.htm http://www.mydomains.com/forums/
It works, but is it correct and SE friendly? I understand there is an issue with 302s and Search Engines but I don't know if it pertains to how I used it in mydomains.com. I would also like to point out that everything about RewriteEngine was put there by my host automatically upon account creation, so of course, I didn't touch it.
Thank you very much WW.
-Chris
Since you are redirecting *all* requests from the singular domain to the plural, most of that code is overkill. All you will need in the example.com server is this part:
RewriteEngine on
RewriteRule (.*) http://www.examples.com/$1 [R=301,L]
Redirect 301 / http://www.examples.com/
Then put the access control code, the "www" redirect, and the temporary redirect to /forums into the examples.com server config.
Jim