301 domain name to another site
-
I had 2 websites. I decided not to maintain one of them and set it to 301 to my main website. However, i see people getting 404 errors when they land on my main website but with a page name from the old site. How can I set things so that anyone who tries to go to the old site goes to my homepage of my main site?
http://oldsiteB.com/oldpagename sends them to http://siteA.com//oldpagename = 404 - I want them to go directly to homepage on siteA.
-
Try to put that .htaccess on the old site. It will rewrite the asked URL before it can be processed by the server. It will rewrite the request to contain the new domain.
On the new domain, you already have the code to process these requests.
Try that and report back. It probably works after that.
-
No, I put it on the .htaccess on the new site. I had 301'd the whole old site in my domain name manager. Maybe I should not do that so I can put an .htaccess file right on the old domain?
-
Ok, just to be sure: you have placed this .htaccess on the old site. Right?
If that is the case and you've pasted the exact code i mentioned, then something else might be causing the issue.
Also: be sure to try this with a browser that hasn't visited the site in a while. It happens to me sometimes that the browser will simply remember the redirect and not follow the .htaccess.
Hope any of this helps!
-
Actually, I tried that, and the result is still
Old URL: "www.myoldsite.com/my-page/"
New URL: "www.mynewsite.com/404.html -
Yes, that helps, thank you!
-
Ok so i had to test this one because i wasn't sure but you would have to remove "$1" from the last line.
That piece actually will add the file path of the original domain and add it to the domain you are redirecting the visitor to.
So this "www.myoldsite.com/my-page/"
Will become "www.mynewsite.com/my-page/"Since you want it this way:
Old URL: "www.myoldsite.com/my-page/"
New URL: "www.mynewsite.com/"Removing the "$1" should do the trick.
Is this an answer to your question?
Bas
-
Can I use this option and somehow direct all traffic from old site to my new home page? I tried this and if someone was trying to find a specific page on the old site they get a 404 on the new.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^OLDSITE.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.OLDSITE.com [NC]
RewriteRule ^(.*)$ http://NEWSITE/$1 [L,R=301,NC] -
Hi,
You have 2 methods that i would use:
Method #1: using .htaccess
Option A: redirect one specific URL to a new specific URL:
Redirect 301 /old/old.html http://NEWSITE/new.htmlNote: 'old/old.html' has to be without the domain name: so just the directory + page.
Option B: redirect an entire directory to a new specific URL:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^OLDSITE.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.OLDSITE.com [NC]
RewriteRule ^(.*)$ http://NEWSITE/$1 [L,R=301,NC]Note: the second line of that example has to be without 'www'.
Method #2: using PHP
If you have one header-file, you can place this code in the top of that php-file:
header( "Status: 301 Moved Permanently" ); header( "Location: http://NEWSITE" ); exit(0); ?>Would that provide an answer for you?
Yours,
Bas
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
-
Another client copies everything to blogspot. Is that what keeps her site from ranking? Or what? Appears to be a penalty somewhere but can't find it.
This client has a brand new site: http://www.susannoyesandersonpoems.com Her previous site was really bad for SEO, yet at one time she actually ranked on the first page for "LDS poems." She came to me because she lost rank. I checked things out and found some shoddy SEO work by a very popular Wordpress webhoste that I will leave unnamed. If you do a backlink analysis you can see the articles and backlinks they created. But there are so few, so I'm not sure if that was it, or it just was because of the fact that her site was so poorly optimized and Google made a change, and down she fell. Here's the only page she had on the LDS poems topic in her old site: https://web.archive.org/web/20130820161529/http://susannoyesandersonpoems.com/category/lds-poetry/ Even the links in the nav were bad as they were all images. And that ranked in position 2 I think she said. Even with her new site, she continues to decline. In fact she is nowhere to be found for main keywords making me think there is a penalty. To try and build rank for categories, I'm allowing google to index the category landing pages and had her write category descriptions that included keywords. We are also listing the categories on the left and linking to those category pages. Maybe those pages are watered down by the poem excerpts?? Here's an example of a page we want to rank: http://susannoyesandersonpoems.com/category/lds-poetry/ Any help from the peanut gallery?
Technical SEO | | katandmouse0 -
Changing Domain Name
Hi all, A client has just got their .edu domain and they want to change their current domain name (a .com) to this new .edu domain. The domain's CMS is Wordpress. Please correct me if I'm wrong, but basically I will need to create a new site (but they want to keep current design), move everything across to the new domain name, and 301 URL per URL? What about all the citations that the old URLs have gotten? The website is listed on Google listings/maps for some of their local keywords. Is there anyway to preserve this? Thank you all in advance.
Technical SEO | | EdwardDennis0 -
Domain Registrar
Looking for opinions on some good domain registrars since I have decided to transfer from Godaddy. A question while I'm here discussing the topic. Does the reputation of a Domain Registrar affect SEO in any form?
Technical SEO | | greenfoxone0 -
Blog.domain.co.uk or domain.co.uk/blog
Hi Guys, I'm just wondering which offers more SEO value and which is easier to set up out of: blog.domain.co.uk domain.co.uk/blog Thanks, Dan
Technical SEO | | Sparkstone0 -
Is it better to delete web pages that I don't want anymore or should I 301 redirect all of the pages I delete to the homepage or another live page?
Is it better for SEO to delete web pages that I don't want anymore or should I 301 redirect all of the pages I delete to the homepage or another live page?
Technical SEO | | CustomOnlineMarketing0 -
I am Posting an article on my site and another site has asked to use the same article - Is this a duplicate content issue with google if i am the creator of the content and will it penalize our sites - or one more than the other??
I operate an ecommerce site for outdoor gear and was invited to guest post on a popular blog (not my site) for a trip i had been on. I wrote the aritcle for them and i also will post this same article on my website. Is this a dup content problem with google? and or the other site? Any Help. Also if i wanted to post this same article to 1 or 2 other blogs as long as they link back to me as the author of the article
Technical SEO | | isle_surf0 -
Delete old site but redirect domain to a new domain and site
I just have a quick query and I have a feeling about what the answer is so just wanted to see what you guys thought... Basically I am working on a client site. This client has a few other websites that are divisions of their company. However these divisions/websites are no longer used. They are wanting to delete the websites but redirect the domains to their name main website. They believe this will pass on SEO benefits as these old division sites are old and have a good PR and history. I'm unsure for DEFINITE, which way is correct?
Technical SEO | | Weerdboil0 -
What's the best way to transplant a blogger blog to another domain?
So I have this client who's got a killer blogger blog—tons of inbound links, great content, etc. He wants to move it onto his new website. Correct me if I'm wrong, but there isn't a single way to 301 the darn thing. I can do meta refresh and/or JavaScript redirects, but those won't transfer link juice, right? Is there a best practice here? I've considered truncating each post and adding a followed "continue reading…" link, which would of course link to the full post on the client's new site. It would take a while and I'm wondering if it would be worth it, and/or if there are any better ideas out there. Sock it to me.
Technical SEO | | TheEspresseo0