How Can I Redirect an Old Domain to Our New Domain in .htaccess?
-
There is an old version of http://chesapeakeregional.com still floating around the web here: http://www.dev3.com.php53-24.dfw1-2.websitetestlink.com/component/content/category/20-our-services. Various iterations of this domain pop up when I do certain site:searches and for some queries as well (such as "Diagnostic Center of Chesapeake").
About 3 months ago the websitetestlink site had files and a fully functional navigation but now it mostly returns 404 or 500 errors. I'd like to redirect the site to our newer site, but don't believe I can do that in chesapeakeregional.com's .htaccess file. Is that so and would I need access to the websitetestlink .htaccess to forward the domain?
Note* I (nor anyone else in our organization) has the login for the old site. The new site went live about 9 months before I arrived at the organization and I've been slowly putting the pieces together since arriving.
-
Sorry Sean, I misunderstood your question. No, you cannot redirect any website you don't have access to. My recommendation would be to contact the host and work with them to obtain access. It's usually not a complex process.
-
Hi Brett,
I've tried the above and previously found the InMotion Hosting resource. I'm able to redirect pages on chesapeakeregional.com just fine. I believe I cannot do the above in the ches reg .htacess because the site I want to redirect from is a different domain. If I could, there wouldn't be anything to stop anyone from redirecting, say facebook.com, to their own website...unless I'm misunderstanding something.
-
There are several resources around the net that show how to do this. Here's a code snippet provided by http://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]If this doesn't work for you, here are some other resources:
https://www.internetmarketingninjas.com/blog/search-engine-optimization/301-redirects/
https://css-tricks.com/snippets/htaccess/301-redirects/
http://www.bruceclay.com/blog/how-to-properly-implement-a-301-redirect/The first code example is more canonical friendly. The simple version I see used a lot and recommended in the other resources I've provided looks like this:
RedirectMatch 301 ^(.*)$ http://www.xyz.com
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
-
Migrating Subfolder content to New domain Safely
Hello everyone, I'm currently facing a challenging situation and would greatly appreciate your expertise and guidance. I own a website, maniflexa.com, primarily focused on the digital agency niche. About 3 months ago, I created a subfolder, maniflexa.com/emploi/, dedicated to job listings which is a completely different niche. The subfolder has around 120 posts and pages. Unfortunately, since I created the subfolder, the rankings of my main site have been negatively impacted. I was previously ranking #1 for all local digital services keywords, but now, only 2 out of 16 keywords have maintained their positions. Other pages have dropped to positions 30 and beyond. I'm considering a solution and would like your advice: I'm planning to purchase a new domain and migrate the content from maniflexa.com/emploi/ to newdomain.com. However, I want to ensure a smooth migration without affecting the main domain maniflexa.com rankings and losing backlinks from maniflexa.com/emploi/ pages. Is moving the subfolder content to a new domain a viable solution? And how can I effectively redirect all pages from the subfolder to the new domain while preserving page ranks and backlinks?
Intermediate & Advanced SEO | | davidifaso
I wish they did, but GSC doesn't offer a solution to migration content from subfolder to a new domain. 😢 Help a fellow Mozer. Thanks for giving a hand.0 -
Phasing in new website on www2 domain - 301 plan
Hi, I work for a large company and we're planning to phase in a new website. The idea is to develop key journeys on the new site and serve them on a www2 domain, removing them from the old website which is served on the www domain. The reason for this is because the old website is over 2,000 pages, and the management want to see new, improved journeys sooner rather than later. So, rather than launching all new pages and journeys at the same time, which will take a long time to design and develop, key journeys will move across to the new site / design sooner and made available to visitors. Whilst the overall journey might be a bit disjointed in parts (i.e. sending people from old to new site, and vice versa) I can't see a better way of doing it... Once all new content is complete, 301s will be implemented from old content on www. to new content www2. Once the phasing is complete, and all new content is in place on www2, 301s will be implemented to point everything back to www. Does anybody see any problems with this approach? Or any ideas on how to better handle this situation? Thanks Mozzers!
Intermediate & Advanced SEO | | RWesley0 -
Localized Domain Issue - Can I use Search Console to solve this?
Struggling through trying to resolve a complicated search issue - would appreciate any community input or suggestions. The Background Info We have several brand sites and each one has both a .ca and .com domain. For some reason, our website platform was created in a way that hundreds of pages on the .com domain have an equivalent page on the .ca domain, which are all 301'ed to the appropriate .com pages. Example below for clarity: www.domain.ca/gadget/brand - 301 Redirected to: www.domain.com/gadget/brand www.domain.ca/gadget/en/brandcanada = Proper .ca Canadian URL (where en is the language - fr exists as well) The Problem Because these .com pages exist under the .ca domain as well, they have started to outrank the correct .ca pages on Google. This has led to Canadian customers finding incorrect information, pricing, and reviews for these products - causing all sorts of customer service issues and therefore affecting our sales. I am being told that to properly fix the issue, and remove the incorrect URLs under the .ca domain would be prohibitively expensive in terms of resources, so I'm left trying to fix this via means available to me (i.e. anything but a change to how the platform is currently setup). The Attempted Fix I've submitted proper sitemaps for the .ca brand sites, and we have also created a robots.txt file to be accessed only when the site is crawled through the .ca domain. In that robots.txt, we have Disallowed crawling of any /gadget/brand/ URLs for the .ca domain. This was done a week ago and I am still seeing the .com URL show up in search results. The Question Should I be submitting any www.brand.ca/gadget/brand/ URLs to be temporarily removed from Google? Because of the 301 redirect in place from www.brand.ca/gadget/brand to www.brand.com/gadget/brand, I am hesitant to do so, as I do not want the .com URL removed. Will Google simply remove the .ca URL and not follow the 301 redirect to remove that URL as well? Any additional insight or feedback would be awesome as well.
Intermediate & Advanced SEO | | Trevor-O0 -
Redirecting old mobile site
Hi All, Trying to figure out the best option here. I have a website that used to utilize a separate mobile site (m.xyz.com) but now utilizes responsive design. What is the best way to deal with that old mobile site? De-index? 301 redirect back to the main site in the rare case someone finds the m. site somewhere? THanks! Ricky
Intermediate & Advanced SEO | | RickyShockley0 -
Client rebranded with a new website but can't migrate now defunct franchise website to new website.
Hi everyone, My client is a chain of franchised restaurants with a local domain website named after the franchise. The franchise exited the market while the client stayed and built its own brand with a separate website. The franchise website (which is extremely popular) will be shut down soon but the client will not be able to redirect the franchise website to the new website for legal reasons. What can I do to ensure that we start ranking immediately for the franchise keyphrase as soon as the franchise website is shutdown. We currently have the new website and access to the old website (which we can't redirect) Thanks, T
Intermediate & Advanced SEO | | Tarek_Lel0 -
Can multiple redirects from old URLs hurt SEO?
We have a client that had an existing site with existing rankings. We rebuilt the site using DNN 7 and created/tested 301 redirects from all the Original URLs to the new DNN URLs which are nasty and have /tabid/1234 and will not allow for dashes (-)'s We have found a DNN module that will make the DNN 7 URLs search friendly. However, that will cause us to 301 the current DNN urls to the new URLs so in fact the original will redirect to the DNN and the DNN will redirect to the rewritten SEO friendly URLs. What should we know here before proceeding?
Intermediate & Advanced SEO | | tjkirgin0 -
Move to a new domain - How to get the redirects right?
Hi, I hope that someone with good htaccess knowledge can help. I am planning on moving my site to a new domain. I understand that I should make 301 redirects using htaccess for every URL. This is a big site so it will be impossible to not forget some of the thousands existing URLs. Now to the question: How do I make all the URLs that is not specified in htaccess to redirect to my new root? Thanks!
Intermediate & Advanced SEO | | mrlolalot0 -
WWW vs Non-WWW/Moving a site to a new CMS/Redirect all of the previous URLs
We are working on a new design for a website, which is currently on a CMS that has non-seo-friendly URLs. There is no redirection of 'www' to non-www or vice versa, or handling of homepage redirection so there is only one instance of 'home'. To move the site in the future, all of these URLs will have to be redirected to their new, and I hope, seo-friendly counterparts. Is it prudent now to redirect the four home page links so there is only one? and to redirect all non-www to 'www' so there is only one instance of each page? Or should I leave it and redirect all of them when the time comes?
Intermediate & Advanced SEO | | haan_seo0