Forcing Subdomain Redirect With htaccess
I just happened to do a search for my site, recordingreview.com, in Google and I noticed that I had two entries for my forum (which is on a subdomain).
www.recordingreview.com/forum/
and
forum.recordingreview.com/ both appeared.
This is bad news for duplicated content! So, I immediately hopped on a few forums but none of them seamed to know the answer. I was also concerned that I would mess something up in vBSEO.
So here is the solution to force a subdomain to ONLY go to the subdomain.
Note:
- This htaccess MUST be in the folder you want to redirect from.
- This will only be necessary on servers that allow you to access the subdomain by typing in domain.com/subdomain/
RewriteCond %{HTTP_HOST} !^forum\.recordingreview\.com
RewriteRule (.*) http://forum.recordingreview.com/$1 [L,R=301]
Related posts:
- htaccess Folder Protection Allows Single Referrer Here's an .htaccess script to only allow a single domain...
Related posts brought to you by Yet Another Related Posts Plugin.