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
-
Wordpress Redirect Loop on domain name
Hi hopefully someone can help - pulling my hair out - can't seem to find where this redirect is coming from. Curently there is a redirect from http://bimi to https://bimi then to our real domain https://www.bimi But I can't find it - I have checked through hta access file, through YOAST redirects - any suggestions from anyone who has has this before in wordpress? | http://bimi.co | 23 | 0 | 3 | |
Technical SEO | | KellyDSD86
| | | Associated Pages | |
| | | https://bimi.co/ | 23 | 1 | | |
| | | Office Furniture Online | The UK's major Office Furniture Retailer | BiMi.cohttps://www.bimi.co/ | HTA access says the following - I have googled to see whether its causing it but none the wiser! BEGIN LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! <ifmodule litespeed="">RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule ^min/\w+.(css|js) - [E=cache-control:no-vary] marker CACHE RESOURCE start RewriteRule wp-content/./[^/](responsive|css|js|dynamic|loader|fonts).php - [E=cache-control:max-age=3600] marker CACHE RESOURCE end marker FAVICON start RewriteRule favicon.ico$ - [E=cache-control:max-age=86400] marker FAVICON end ###</ifmodule> LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END LSCACHE BEGIN NON_LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! marker MINIFY start <ifmodule mod_rewrite.c="">RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+).(css|js)$
RewriteCond %1/wp-content/cache/$2/$1.$2 -f
RewriteRule min/(\w+).(css|js) wp-content/cache/$2/$1.$2 [L]</ifmodule> marker MINIFY end LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END NON_LSCACHE BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress0 -
Help: domain name change and Google News
Hi. I work for a regional news source, and our (separate) Spanish-language news publication recently changed its domain name. The publication lost its Google News inclusion. Most of their traffic came from Google News, so traffic tanked. They're trying to get back in. They reapplied but didn't get approved. They're now in the 30-day waiting period to reapply again. The website is run by a third-party company, which handled the domain name change in April (2015). That company has been running their site for a couple of years. Our in-house devs' hands are tied on helping, because we (at the mother company) don't manage their site. This third party has not been responsive. The Spanish pub folks have reached out to me to help them prepare for Round 2 of reapplication. I'm the mothership in-house SEO, but I've never experienced this situation before. Because everything seems to be in order besides the ham-handed changes, my best advice to them so far is: You'll have to wait until Google gets to know you again, unfortunately. Does that sound right? Any pointers out there for bringing their best possible A-game to the next round?
Technical SEO | | christyrobinson1 -
Home link tags slash or full domain name
Recently I was asked the question by a client who has some SEO knowledge..... We built their site and during testing we simply set the home page links to be: home rather than: home This was mainly to help while in test and dev as they were on different servers to the live site and if we had put the full domain in it kept taking us from dev/test to live. Is it bad to have just a slash for SEO purposes or is it REALLY that important on home links to have the full domain as a slash takes you back to the full domain? Thanks
Technical SEO | | spiralsites0 -
To 301 redirect or not to 301 redirect? duplicate content problem www.domain.com and www.domain.com/en/
Hello, If your website is getting flagged for duplicate content from your main domain www.domain.com and your multilingual english domain www.domain.com/en/ is it wise to 301 redirect the english multilingual website to the main site? Please advise. We've recently installed the joomish component to one of our joomla websites in an effort to streamline a spanish translation of the website. The translation was a success and the new spanish webpages were indexed but unfortunately one of the web developers enabled the english part of the component and some english webpages were also indexed under the multilingual english domain www.domain.com/en/ and that flagged us for duplicate content. I added a 301 redirect to redirect all visitors from the www.domain/en/ webpages to the main www.domain.com/ webpages. But is that the proper way of handling this problem? Please advise.
Technical SEO | | Chris-CA0 -
When Is It Good To Redirect Pages on Your Site to Another Page?
Suppose you have a page on your site that discusses a topic that is similar to another page but targets a different keyword phrase. The page has medium quality content, no inbound links, and the attracts little traffic. Should you 301 redirect the page to a stronger page?
Technical SEO | | ProjectLabs1 -
.com domain is an iframe copy of a .net domain?
Hey folks, This one is over my head. I'm helping out a friend's dental office website (www.capitolperiodontal.com), and their home page source code points to the .net TLD for its content apparently: | | <title></span>http://www.capitolperiodontal.com/</title> http-equiv="content-type" content="text/html" /> rows="100%" id="dd_frameset_0001"> src="http://www.capitolperiodontal.net/" name="dd_content_0001" framespacing="0" frameborder="0" noresize="noresize" title="capitolperiodontal.com" /> <noframes></noframes> My idea was to load all the content from the .net to the .com, then redirect the .net to the .com as it has better domain authority and is, well a .com. Any insights what this iframe biz is all about and if my strategy above is ok? Many thanks folks! john
Technical SEO | | juanzo0070 -
How to handle a merge with another site
I own a gaming site at legendzelda.net Recently a site zelda-temple.net wanted to merge communities and sites. We pretty much scrapped their content (a lot was articles I already had topics on), merged the user databases, and redirected the domain to mine. What is the best seo way to redirect that domain. I tried to set up a 301 on the entire domain to gain all the backlinks that site had (A LOT) but it seems as if a lot are not being picked up by the open site explorer and other tools. Advice?
Technical SEO | | webfeatseo0 -
If I point a domain name to a new faster server, will I lose some keyword ranking?
I'm redesigning a client's site, breaking up content into separate pages and moving the site to a managed server keeping the same domain name. Will I lose any link juice or keyword ranking for site even if I 301 redirect the old pages to the new titled pages?
Technical SEO | | sirmarkthomas0