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
-
'domain:example.com/' is this line with a '/' at the end of the domain valid in a disavow report file ?
Hi everyone Just out of curiosity, what would happen if in my disavow report I have this line : domain:example.com**/** instead of domain:example.com as recommended by google. I was just wondering if adding a / at the end of a domain would automatically render the line invalid and ignored by Google's disavow backlinks tool. Many thanks for your thoughts
Technical SEO | | LabeliumUSA0 -
Case study re-directing one site into another?
Hi there, We have access to a third party site that has high domain authority and we want to know if anyone has a case study demonstrating what happens when you 301-redirect a high DA site to another high DA site. In particular, we are wondering what kind of lift the site saw from the additional link equity?
Technical SEO | | nicole.healthline0 -
Purchased domain with links - redirect page by page or entire domain?
Hi, I purchased an old domain with a lot of links that I'm redirecting to my site. I want all of their links to redirect to the same page on my site so I can approach this two different ways: Entire site
Technical SEO | | ninel_P
1.) RedirectMatch 301 ^(.*)$ http://www.xyz.com or Page by page
2). Redirect 301 /retiredpage.html http://www.xyz.com/newpage.html Is there a better option I should go with in regards to SEO effectiveness? Thanks in advance!0 -
Redirecting old html site to new wordpress site
Hi I'm currently updating an old (8 years old) html site to wordpress and about a month ago I redirected some url's to the new site (which is in a directory) like this... Redirect 301 /article1.htm http://mysite.net/wordpress/article1/
Technical SEO | | briandee
Redirect 301 /article2.htm http://mysite.net/wordpress/article2/
Redirect 301 /article3.htm http://mysite.net/wordpress/article3/ Google has indexed these new url's and they are showing in search results. I'm almost finished the new version of site and it is currently in a directory /wordpress I intend to move all the files from the directory to the root so new url when this is done will be http://mysite.net/article1/ etc My question is - what to I do about the redirects which are in place - do I delete them and replace with something like this? Redirect 301 /wordpress/article1/ http://mysite.net/article1/
Redirect 301 /wordpress/article2/ http://mysite.net/article2/
Redirect 301 /wordpress/article3/ http://mysite.net/article3/ Appreciate any help with this0 -
Long Domain Name - Subpage URL Question
I have a long domain name, so domainname/services/page title can get pretty lengthy. I have a services page, as a summary page since there's a few of htem, with more detailed on the actual page. In this situation, would it be better to do domainname.com/services/service-name which can exceed the suggested 70 characters, or would it be a better idea to do domain.com/service-name and just have hte m under the services menu? Is there any advantage/disadvantage to going out 2-3 tiers? or having the sub pages of those services off the domain instead of a child of the root child page Please let me know if any clarification is needed. Thanks!
Technical SEO | | tgr0ss0 -
Moving a site from one server to another
Does moving a site's files from one server to another, with all URL's remaining the same, affect page rank? I am moving a site from one server to another. Everything will stay exactly the same, including URL's, file structure, etc. Will this affect page rank, domain importance, etc?
Technical SEO | | Bandicoot0 -
What is the best method to block a sub-domain, e.g. staging.domain.com/ from getting indexed?
Now that Google considers subdomains as part of the TLD I'm a little leery of testing robots.txt with something like: staging.domain.com
Technical SEO | | fthead9
User-agent: *
Disallow: / in fear it might get the www.domain.com blocked as well. Has anyone had any success using robots.txt to block sub-domains? I know I could add a meta robots tag to the staging.domain.com pages but that would require a lot more work.0