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
-
1 multilingual site, 2 domains in different languages.
My client wants a multilingual site: English and Spanish but with a domain name in both languages: jorgewantstofight.com And jorgequierepelear.com Is it possible? To have 1 site with both domains pointing each one to its version? and how this affects SEO?
Technical SEO | | Trazo1 -
.htaccess Question
Hi,I have a website www.contractor-accounts.co.uk that has an .htaccess file that strips .php and forces a closing brace /. The site is now over 6 months old and still has a very low ranking with MOZ also rating the site as DA/PA = 1 which seems to indicate some sort of issue with the website. Can anyone offer any suggestions as to why this site is ranking poorly as much of the onpage SEO has been completed to a level of 90%+ for specific keyterms so I'm probably either looking at routing of the framework of so other technical SEO issues possibly? Any help much apreciated... <ifmodule mod_rewrite.c=""><ifmodule mod_negotiation.c="">Options -MultiViews</ifmodule> RewriteEngine On # Redirect Trailing Slashes...
Technical SEO | | ecrmeuro
# RewriteRule ^(.)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} /+[^.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
# Redirect non-WWW to WWW...
RewriteCond %{HTTP_HOST} ^contractor-accounts.co.uk [NC]
RewriteRule ^(.)$ http://www.contractor-accounts.co.uk/$1 [L,R=301] # Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]</ifmodule>0 -
Mobile site backlinks?
Hello, Our mobile site redirects to desktop in a desktop browser and vice versa; however, they are different sites. This said, shouldn't the backlinks for our mobile site be the same as for our desktop site since one redirects to the other. We show no backlinks in my analysis? Any help or insight would be extremely appreciated! Thank you!
Technical SEO | | lfrazer1 -
Site Navigation
Hello, I have some questions about best practices with site navigation & internal linking. I'm currently assisting aplossoftware.com with its navigation. The site has about 200 pages total. They currently have a very sparse header with a lot of links in the footer. The three most important keywords they want to rank for are nonprofit accounting software, church accounting software and file 990 online. 1. What are your thoughts about including a drop down menu in the header for the different products? (they have 3 main products). This would allow us to include a few more links in the header and give more real estate to include full keywords in anchor text. 2. They have a good blog with content that gets regularly updated. Currently it's linked in the footer and gets a tiny amount of visits. What are your thoughts about including it as a link in the header instead? 3. What are best practices with using (or not using) no follow with site navigation and footer links? How about with links to social media pages like Facebook/Twitter? Any other thoughts/ideas about the site navigation for this site (www.aplossoftware.com) would be much appreciated. Thanks!
Technical SEO | | stageagent0 -
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 -
Adding academic content for a school in a sub folder, sub domain, or different site?
I manage the website for a school and we are planning to put our academic policies/student handbook online. I’m curious if there is any SEO value to including this content in our main website? This isn’t stuff that anyone is going to link to externally (student orientation procedures, how to enroll/drop credits, academic warning policies etc) and there would be limited internal linking as well (someone looking for course information doesn’t want to see this type of stuff). I’m not interested in SERPs for this content, but I’m wondering if the additional content could help the site’s SEO overall? It is naturally rich with ‘academic’ keywords and the only websites that use this type of content are universities. On a similar note, I need to put up student profiles for potential employers to view. Like the policies, this is not priority content for someone visiting our website, but it is still keyword-rich content, which would add to the overall 'size' of the site. Should this stuff go in a folder, a subdomain, or in a different location altogether?
Technical SEO | | AISFM0 -
International Site Links In Footer
We have several international sites and we have them linked in the footer of our main .com site . Should we add "nofollow" to these links? Our concern is that Google could see these sites as a network?
Technical SEO | | EwanFisher0 -
Moving Duplicate Sites
Apologies in advance for the complexity. My client, company A, has purchased company B in the same industry, with A and B having separate domains. Current hosting arrangement combines registrar and hosting functions in 1 account so as to allow both domains to point to a common folder, with the result that identical content is displayed for both A & B. The current site is kind of an amalgam of A and B. Company A has decided to rebrand and completely absorb company B. The problem is that link value overwhelmingly favours B over A. The current (only) hosting package is Windows, and I am creating a new site and moving them to Linux with another hosting company. I can use 301's for A , but not for B as it is a separate domain and currently shares a hosting package with A. How can I best preserve the link juice that domain B has? The only conclusion I can come up with is to set up separate Linux hosting for B which will allow for the use of 301's. Does anyone have a better idea?
Technical SEO | | waynekolenchuk0