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 Link Issues
For several search terms I get site links for the page http://www.waikoloavacationrentals.com/kolea-rentals/kolea-condos/ It makes sense that that page be a site link as it is one of my most used pages, but the problem is google gave it the site link "Kolea 10A". I am having 0 luck making any sense of why that was chosen. It should be something like "Kolea Condos" or something of that nature. Does anyone have any thoughts on where google is coming up with this?
Technical SEO | | RobDalton0 -
Number of index pages in web master is different from site:mydomainname
Google says one to discover whether my pages is index in Google is site:domain name of my website: https://support.google.com/webmasters/answer/34444?hl=enas mention in web page above so basically according to that i can know totally pages indexed for my website right:it shows me when type (site:domain name ) 300 but it says in Google web master that i have 100000so which is the real number of index page 300 or 1000000 as web master says and why i get 300 when using site:domain name even Google mention that it is way to discover index paged
Technical SEO | | Jamalon0 -
I noticed all my SEOed sites are getting attacked constantly by viruses. I do wordpress sites. Does anyone have a good recommendation to protect my clients sites? thanks
We have tried all different kinds of security plugins but none seem to work long term.
Technical SEO | | Carla_Dawson0 -
How to link site.com/blog or site.com/blog/
Hello friends, I have a very basic question but I can not find the right answer... I have made my blog linkbuilding using the adress "mysite.com/blog" but now im not sure if is better to do the linkbuilding to "mysite.com**/blog/ "** Is there any diference? Thanks...
Technical SEO | | lans27870 -
How different should content be so that it is not considered duplicate?
I am making a 2nd website for the same company. The name of the company, our services, keywords and contact info will show up several times within the text of both websites. The overall text and paragraphs will be different but some info may be repeated on both sites. Should I continue this? What precautions should I take?
Technical SEO | | savva0 -
Multilingual blogs and site structure
Hi everyone, I have a question about multilingual blogs and site structure. Right now, we have the typical subfolder localization structure. ex: domain.com/page (english site) domain.com/ja/page (japanese site) However, the blog is a slightly more complicated. We'd like to have english posts available in other languages (as many of our users are bilinguals). The current structure suggests we use a typical domain.com/blog or domain.com/ja/blog format, but we have issues if a Japanese (logged in) user wants to view an English page. domain.com/blog/article would redirect them to domain.com/ja/blog/article thus 404-ing the user if the post doesn't exist in the alternate language. One suggestion (that I have seen on sites such as etsy/spotify is to add a /en/ to the blog area: ex domain.com/en/blog domain.com/ja/blog Would this be the correct way to avoid this issue? I know we could technically work around the 404 issue, but I don't want to create duplicate posts in /ja/ that are in English or visa versa. Would it affect the rest of the site if we use a /en/ subfolder just for the blog? Another option is to use: domain.com/blog/en domain.com/blog/ja but I'm not sure if this alternative is better. Any help would be appreciated!
Technical SEO | | Seiyav0 -
404 Errors After Site Migration
Hello - I'm working on a website selling fashion accessories. The site just went through a site migration from Yahoo! to Big Commerce. Now we have a high level of warnings and errors from the crawl. Few are mentioning sites I never seen before on the Yahoo! platform. I also notice that the pages crawled has doubled. How can I fix or did I do something wrong with migration? I was running the website with minimal errors and now overwhelmed with errors all the error updates. If I can get some assistance on what could be wrong, I would greatly appreciate. Thanks.
Technical SEO | | ShopChameleon0 -
Site not indexing correctly
I am trying to figure out what is going on with my site listings. Google is only displaying my title and url - no description. You can see it when you search for Franchises for Sale. The site is www.franchisesolutions.com. Why could this happen? Also I saw a big drop off in a handful of keyword rankings today. Could this be related?
Technical SEO | | franchisesolutions0