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
-
Site redesign makes Moz Site Crawl go haywire
I work for an agency. Recently, one of our clients decided to do a complete site redesign without giving us notice. Shortly after this happened, Moz Site Crawl reported a massive spike of issues, including but not limited to 4xx errors. However, in the weeks that followed, it seemed these 4xx errors would disappear and then a large number of new ones would appear afterward, which makes me think they're phantom errors (and looking at the referring URLs, I suspect as much because I can't find the offending URLs). Is there any reason why this would happen? Like, something wrong with the sitemap or robots.txt?
Technical SEO | | YYSeanBrady1 -
Site dropped from SERP
Hello, I've been ranking a site for the last 5 months with good success, ranking on the first page for a high traffic keyword. In the beginning of September however, my site completely dropped out of the SERPs for several of those keywords yet my site was still indexed and there was no penalty applied to my site via search console. I would assume this maybe because of the update during the time.My site came back again a week later and it was ranking much higher on the first page (#2). Today, I just checked the SERPs and my site is now gone again. It was there this morning but now as of two hours ago it is gone, as well as one of my main competitors. My site is still indexed and no penalties via search console. Does anyone know what causes these types of issues? Im assuming my site will come back in a week or so with hopefully the same or better ranking, but when I have disruptions like this it really hurts my organic traffic. Any input is appreciated. Thanks!
Technical SEO | | KathleenDC0 -
Site Launching, not SEO Ready
Hi, So, we have a site going up on Monday, that in many ways hasn't been gotten ready for search. The focus has been on functionality and UX rather than search, which is fair enough. As a result, I have a big list of things for the developer to complete after launch (like sorting out duplicate pages and adding titles that aren't "undefined" etc.). So, my question is whether it would be better to noindex the site until all the main things are sorted before essentially presenting search engines with the best version we can, or to have the site be indexed (duplicate pages and all) and sort these issues "live", as it were? Would either method be advisable over the other, or are there any other solutions? I just want to ensure we start ranking as well as possible as quickly as possible and don't know which way to go. Thanks so much!
Technical SEO | | LeahHutcheon0 -
Will Links to one Sub-Domain on a Site hurt a different Sub-Domain on the same site by affecting the Quality of the Root Domain?
Hi, I work for a SaaS company which uses two different subdomains on our site. A public for our main site (which we want to rank in SERPs for), and a secure subdomain, which is the portal for our customers to access our services (which we don't want to rank for) . Recently I realized that by using our product, our customers are creating large amounts of low quality links to our secure subdomain and I'm concerned that this might affect our public subdomain by bringing down the overall Authority of our root domain. Is this a legitimate concern? Has anyone ever worked through a similar situation? any help is appreciated!
Technical SEO | | ifbyphone0 -
If you are organizing the site structure for an ecommerce site, how would you do it?
Should you use not use slashes and use all dashes or use just a few slashes and the rest with dashes? For example, domain.com/category/brand/product-color-etc  OR  domain.com/anythinghere-color-dimensions-etc Which structure would you rather go for and why?
Technical SEO | | Zookeeper0 -
What can we do to improve our site
Hi. I am hoping that some of you can help me with the in2town site www.in2town.co.uk The site is a news/lifestyle magazine site. The site is a cross between, huffington post, digital spy, female first and the sun newspaper. Basically the site is a news site as well as covering showbiz news, travel news, health news and advice etc What i would like is for people to look at the site and let me know what they feel i should do to improve the site to make it better for our readers and to gain more readership. I would also like to hear from people on how they find moving around the site as well as the speed of the site. At the moment the site is with an american hosting company and i am in the process of talking to UK hosting companies to move the site. The site is currently on a dedicated server. It would mean a lot if people could give me their advice on how to improve the site and make it a beter experience for our readers while at the same time being able to generate income with the site. Just a quick note, all content is original and we have a number of people who write for the site. many thanks
Technical SEO | | ClaireH-1848860 -
See your sites Architecture
Does anybody know a problem where you can see how your internal linkings look to the search engines?
Technical SEO | | ScottBaxterWW0 -
Submitting site to dmoz.org
Over the last couple of years I've repeatedly submitted (about 4 times) our site to dmoz.org, hoping to get listed but have never been successful in getting the site recognized. We have an eCommerce site that deals in automotive parts and accessories. What does it take to get your site accepted in dmoz and how do you go about it? Thanks, Steve
Technical SEO | | SteveMaguire0