Htaccess 301s to 3 different sites
-
Hi,
I'm an htaccess newbie, and I have to redirect and split traffic to three new domains from site A.
The original home page has most of the inbound links so I've set up a 301 that goes to site B, the new corporate domain.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]Brand websites C and D need 301s for their folders in site A but I have no idea how to write that in relationship to the first redirect, which really is about the home page, contact and only a few other pages.
The urls are duplicates except for the new domain names. They're all on Linux..Site A is about 150 pages, should I write it by page, or can I do some kind of catch all (the first 301) plus the two folders?
I'd really appreciate any insight you have and especially if you can show me how to write it.
Thanks
-
You are most welcome! Appreciate your feedback that it worked!
-
Yannick, it worked like a charm to all three new sites. Great info, thank you for taking the time to help me out.
-
You're welcome! Hope everything works out!
Test a few URL's first. Or even better: setup a small test case to make sure it works!
-
Greatness. Thanks!
-
RedirectMatch 301 /subdirectoryA/(.*) http://www.websiteB.com/$1
and
RedirectMatch 301 /subdirectoryB/(.*) http://www.websiteC.com/$1
Otherwise it wont work
About the htaccess from the old site... As long as Website A (the old site) is still up and the redirects on that site is properly set up in the htaccess on that server, I don't see any reason to also use it on the new sites.
-
Thanks Yannick
I'm tracking with you except I have to make the subfolders go not to site B, but new sites...C and D. So can I do it like this:
RedirectMatch 301 /subdirectory/(.*) http://www.websiteC.com/$1
and then
RedirectMatch 301 /subdirectory/(.*) http://www.websiteD.com/$1
The urls match. But the subfolder pages have very few links so I'm less concerned about link juice then just getting the indexing to avoid a bunch of 404s.
The subdirectories on site A got split into 2 freestanding domains for "branding"....and have added a bunch of new pages that don't correspond to the old folder (though some do). They also moved from drupal to WP and I wonder if I need the old htaccess instructions for drupal ? We're keeping the old site in place for a while during the migration.
Thanks so much again for the reply
-
Hi Ellen,
If you only wanted to redirect all the url's in a certain subdirectory to the new site (not 1-on1), your redirect would look something like this:
RedirectMatch 301 ^/subdirectory/$ http://www.websiteB.com/
But... I dont think you want to do that (Or should do that...) I think you should want to redirect all pages in the subdirectory to their corresponding url on websiteB.
What I mean by that is: you should redirect all your pages 1-on1, like this:
Redirect: www.websiteA.com/subdirectory/url1.html to its equivalent on website B's url: www.websiteB.com/url1.html
If you want to do that, you can. But the url's have to be the same. You can do something like:
RedirectMatch 301 /subdirectory/(.*) http://www.websiteB.com/$1
If the url's change, than you have to do more manual work. You should always try to redirect as many pages 1on1 as you can. Especially the ones that receive external links. The new pages will be almost as "juicy" as the old pages, because the 301 redirect passes the linkjuice along. (not all of it though, but like 90% - 99%)
Is this pushing you a bit in the right direction?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Hreflang - different navigation for all countries
Hi all! Currently we are implementing the href lang tag. I'm not really sure how to solve this: We sell our products in the Netherlands and Belgium. For the Netherlands we have 1 category page for pebbles (stones) which contain both rounded and non-rounded pebbles. In the Netherlands there is not really a difference between them (people search for pebbles and that's it). The URL: https://www.website.com/nl/pebbles. In Belgium there is a difference (people specifically search for rounded/non-rounded pebbles). Therefore, in Belgium we have 2 pages (we don't have an overall page): https://www.website.com/be/pebbles-rounded.
Technical SEO | | AMAGARD
https://www.website.com/be/pebbles-non-rounded. My question now is, what to do with the hreflang tags on these pages? Thanks in advance! Best, Remco0 -
White listing a site
A new clients site is blocked by a lot of Firewalls. And I can't work out why, the content is family friendly they sell nursery equipment. I've run it through the Google checker and there is no malicious software found on the site. Can anyone tell me what I need to do to get this site unblocked? The url is http://knuma.co.uk/
Technical SEO | | Marketing_Optimist0 -
Should we handle this redirect differently?
So our question is should we handle page redirection/rewriting in php or in .htaccess (with a specific problem we are running into outlined below). We have an ecommerce store in a subfolder of our site (example.com/store/). In the next folder down we have a group of widgets(www.example.com/store/widget-group1). Recently we put a .htaccess redirect in the top level folder (example.com/store/.htaccess), in order to re-write some URL’s and also 301 a page to another page. This seems to be negatively affecting our /widgets-group1/ subfolder however (organic traffic to example.com/store/widget-group1) took a nose dive 3 days after putting the .htaccess redirect in place on the /store/ folder and it has not recovered 8 days later). *Nothing appears outwardly wrong with the current setup to the eye when viewing the pages or requesting as googlebot (the only issue being the nose dive in organic traffic lol) *both subfolders are setup in apache config file to allow local overrides of .htaccess as follows: <directory store="" widget-group1="">Options -Indexes FollowSymLinks -MultiViews
Technical SEO | | altecdesign
AllowOverride All
Order allow,deny
allow from all</directory> <directory store="">Options -Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all</directory>0 -
Seomoz Can not Crawl My Site
Hello there Seomoz can not crawl my site. It's been 3 days now not a single page has been crawled. I deleted the campaign and tried again still now crawl not a single page.. Any solutions??
Technical SEO | | ExpertSolutions0 -
Best practice for eCommerce site migration, should I 301 redirect or match URLs on new site
Hi Guys, I have been struggling with this one for quite some time. I am no SEO expert like many of you, rather just a small business owner trying to do the right thing, so forgive me if I say something that makes no sense 🙂 I am moving our eCommerce store from one platform to another, in the process the store is getting a massive face lift. The part I am struggling with is whether I should keep my existing URL structure in place or use 301 redirects to create a cleaner looking URLs. Currently the URLs are a little long and I would love to move to a /category/product_name type format. Of course the goal is not to lose ranking in the process, I rank pretty well for several competitive phrases and do not want to create a negative impact. How would you guys handle this? Thanks, Dinesh
Technical SEO | | MyFairyTaleBooks0 -
Mobile Site & SEO
If i create a mobile site for a client will google crawl that site for mobile results or will it effect my rankings. My guess is no, just want to make sure. Obviously code will be different.
Technical SEO | | waqid0 -
Too many 301s?
Hi there, If there is a website that has accidently generated say 1,000 pages of duplicate content, would the seo be hurt if all those pages were re-directed to the origional source of the content? There are no plans to re-write the 1,000 duplicate pages, they are already cached and indexed by Google. I thought about canonical tags but as they have some traffic and a little seo value i thought 301 re-direct would be more appropiate to the relevant pages? I am also right in thinking you would be able to remove the 301 in the .htaccess file once the index has updated? Also once removed the 301 - i could use those urls later from scratch if i wanted? Any info much appreciated.
Technical SEO | | pauledwards0 -
.CA site same as .com site - are both necessary?
Dear Friend, We representa a major national brand in the auto care industry, and they have locations in both US and Canada. There is a primary content site at  .com that we have duplicated at .ca. We are hosting the .ca site on a separate IP on a server in Canada - but by in large it is the same site. (there are some minor changes we made to change US English to Canadian English - though minor. When we search Google.ca we generally see strong search results for the .com site, but rarely, if ever any evidence of rankings for the .ca site. The .com site was launched several years ago about 18 months before the .ca site. Why doesn't Google.ca show the .ca site? Is this an issue of duplicate content, and Google.ca simply shows the .com version which it knew about first? Are we wasting our time, money and efforts having both? Thanks, Tim ps. this isn't about location. We use a separate site to locate local shops, and have coordinated that well with Google Places, and when looking for local auto care - we do well in both US and Canada. The sites described above are largetl content sites.
Technical SEO | | lunavista-comm0