301 Redirect to New Domain: .htaccess

I am looking to break off part of my website and start a new website at a new domain. In order to do this, I’d like to 301 redirect all traffic from the following URLs:

[quote]wearabletechforums.com/compare/
to
comparewear.com[/quote]

[quote]wearabletechforums.com/compare/specs/
to
comparewear.com/comparison/[/quote]

[quote]wearabletechforums.com/compare/specs/?string
to
comparewear.com/comparison/?string[/quote]

There are no other URLs to redirect. Can anyone please help me with the htaccess? Also, are there any SEO or other problems you foresee with this solution?

Thank you.

Redirect 301 /compare/ http://comparewear.com
Redirect 301 /compare/specs/ http://comparewear.com/comparison/

There’s an easy-to-follow basic tutorial on redirects in this article: http://blog.dreamhosters.com/kbase/index.cgi?area=3083

When you say wearabletechforums.com/compare/specs/?string are you using that as an example of a URL with a query string? In which case, I’m not sure how you would write the redirect to match any query string. Hopefully somebody else can help here.

[quote=“geiger, post:1, topic:110151”]
Also, are there any SEO or other problems you foresee with this solution?
[/quote]No. It’s a common technique. The 301 says that the move is permanent, so search engines know to update their records.

1 Like

geiger,

Sorry, I DO see problems:

  1. I would use mod_rewrite to ensure that the domain is the correct domain (do you have multiple domains at your website). THEN see if the {REQUEST_URI} is compare/ before redirecting (#`)
  2. Ditto #1 BUT do this before the more general compare/ match else compare/specs will be hijacked.
  3. Argh! I hate dorcing the DirectoryIndex to get the query string. However, ditto the comment of #2 for both #2 and #1.

SEO: Use the R=301 flag on your redirections and the search engines will update and take care of your search engines.

Regards,

DK

Eek! Please help ASAP. Apparently Google just indexed the new site at comparewear.com and so I need to switch my domain pronto. I need:

to

and

to

I don’t quite understand the post above.

Ok I think it is working with this. How does this look? RewriteRule ^compare/specs/ http://comparewear.com/wearables/ [R=301,L] RewriteRule ^compare/ http://comparewear.com [R=301,L]

Hmm. It seems to be working, however why don’t I see the referrals? I only see 1 from each URL, but there would certainly be more. If the referrals show as the other entries, however, such as Google, why do I see one entry each for wearabletechforums?

geiger,

Assuming that your two domains do NOT share the same directory on the server, those are okay. Otherwise, add RewriteCond %{HTTP_HOST} wearabletechforums\.com$ [NC]to both RewriteRules.

Your webstats are another matter. Not enough traffic to generate more hits on the referrals.

Regards,

DK

Could you please clarify? My hosting account requires that my new domain directory be in my old domain’s public_html folder. I’m looking to change this soon, but you are saying that this affects the redirect? I should add the snippet?

geiger,

Are you on a typical shared hosting account? NEW domain is a subdirectory of OLD domain? Is NEW domain an ADD-ON domain (with its DocumentRoot in the subdirectory of OLD domain)?

If YES to the above, your RewriteRules need to be in the OLD domain’s DocumentRoot. That way, when the redirection is made, it bypasses the OLD domain’s DocumentRoot (and the .htaccess there) and goes directly to the NEW domain’s DocumentRoot.

If the two were co-equal (not a sub of the other), the check of the {HTTP_HOST} would, of course, be necessary.

Regards,

DK

Yes, the new domain is an add-on. However I did place the .htaccess file in the old domains’ public_html folder, and everything seems to be working just fine. See:

http://wearabletechforums.com/compare/specs/?vs=peak&vs=surge

So everything’s okay, right?

geiger,

Your link led to http://comparewear.com/wearables/?vs=peak&vs=surge so that works for me.

Regards,

DK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.