I need help with htaccess redirect
-
Hi guys,
we have the domain cheats.co.uk, it has always displayed as cheats.co.uk without the www.
However it is now showing 2 version of the site, both the www. and the non www. version.
I know how to add to the htaccess folder to get the non www. version going to the www. version but i am worried about doing this because the non www. version has always been the one indexed in Google and has a page rank of 3.
Should i in fact be redirecting the www.version to the non www. version to keep page rank etc? or will page rank be passed over etc if i redirect to the www. version
I hope thats clear
Thanks guys
Jon
-
Any redirect causes an estimated 1 - 10% loss of link juice. If all your links use the non www version, then from a pure SEO link value perspective you should redirect the www version to the non www version of your URL.
If you are on good terms with the sites who are providing those links, you could also ask them to update their links to your new structure. It's a decision you will need to make.
Your htaccess code seems ok. Once again, that is not my area of expertise. I created the code I used with the Redirect app in cPanel and have copied it.
-
Hi Ryan,
Thanks for your answer. I believe that it was the non www version which has been used since existence and this has a page rank 3, i do think it looks better in the serps with the www.version though. From your experience the page rank and most of the link juice that is on the non www. version should transfer over to the www. version in time?
The redirect i was going to put on was
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] -
You can use the "www" or non-www form of your URLs. The important thing is to make a choice then stay consistent with your choice.
PageRank and links will be fine with either choice. Whenever you use a redirect you lose a small amount of link juice. All things being equal, determine which form of URL is most commonly used in your backlinks, then use that URL.
The method for a redirect depends on your hardware and software. The most common configuration for web servers is currently Apache servers with cPanel access. If you have this setup, you can use the Redirect application or ask your host to set the redirect up for you. I would not recommend making the change manually. One character out of place and your server will be instantly inaccessible.
With the above noted, below is code which can be added to your htaccess file to redirect non-www traffic to the www equivalent. I am not a htaccess expert and the code below you can use at your own risk. It works for me.
`RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]`
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
-
Help! Rankings dropping after optimising
I have been using MOZ a lot, in the past I have always been able to optimise a website enough to rank well in my local areas, but lately every time I optimise a website based on MOZ recommendations the rankings are just dropping and dropping... I haven't focused any efforts on backlinks, but a few sites have gone from the first page of SERP to 2nd and continue to drop... I have 2 example sites: https://www.documentmanagementsoftware.com.au/ - optimised for "Document Management Software" - was initially ranked no.7 in google AU, now it is no.16 after my efforts. http://www.tmphysio.com.au/ - optimised for "canberra physiotherapy" - was no.6 now it is dropping to no.9 after 'optimisation' Any help or insights would be extremely helpful as I feel hopeless!
Intermediate & Advanced SEO | | thinkLukeSEO0 -
All URLs in the site is 302 redirected to itself
Hi everyone, I have a problem with a website wherein all URLs (homepage, inner pages) are 302 redirected. This is based on Screaming Frog crawl. But the weird thing is that they are 302 redirected to themselves which doesn't make any sense. Example:
Intermediate & Advanced SEO | | alex_goldman
https://www.example.com.au/ is 302 redirected to https://www.example.com.au/ https://www.example.com.au/shop is 302 redirected to https://www.example.com.au/shop https://www.example.com.au/shop/dresses is 302 redirected to https://www.example.com.au/shop/dresses Have you encountered this issue? What did you do to fix it? Would be very glad to hear your responses. Cheers!0 -
Hacked website - Dealing with 301 redirects and a large .htaccess file
One of my client's websites was recently hacked and I've been dealing with the after effects of it. The website is now clean of malware and I already appealed to Google about the malware issue. The current issue I have is dealing with the 20, 000+ crawl errors which are garbage links that were created from the hacking. How does one go about dealing with all the 301 redirects I need to create for all the 404 crawl errors? I'm already noticing an increased load time on the website due to having a rather large .htaccess file with a couple thousand 301 redirects done already which I fear will result in my client's website performance and SEO performance taking a hit as well.
Intermediate & Advanced SEO | | FPK0 -
Handling Multiple Domain 301 Redirects on Single htaccess file
Hello, I have a client that currently that has 9 different markets with different sub-domains on one server (aka one htaccess file.). All the sites have very similar Navigation and some of them contain the same products aka same URLs. The site is using Magento CMS and I'm trying to figure out how to redirect some products that have been removed from one of the stores. The problem I'm running into is when I try to redirect one store url, it redirects all the site's URLs. Example http://store.domain1.com/ http://store.domain2.com/ I'd like to redirect http://store.domain1.com/old-url.html to http://store.domain1.com/new-url.html without making http://store.domain2.com/old-url.html redirect. I've literally been pulling out my hair trying to figure this one out but have had no luck. Does anybody have any ideas on how I could do this without having the sites redirect or create any loops? Any wisdom from you apache experts would be greatly appreciated. Thanks, Erik
Intermediate & Advanced SEO | | Erik-M0 -
Robot.txt help
Hi, We have a blog that is killing our SEO. We need to Disallow Disallow: /Blog/?tag*
Intermediate & Advanced SEO | | Studio33
Disallow: /Blog/?page*
Disallow: /Blog/category/*
Disallow: /Blog/author/*
Disallow: /Blog/archive/*
Disallow: /Blog/Account/.
Disallow: /Blog/search*
Disallow: /Blog/search.aspx
Disallow: /Blog/error404.aspx
Disallow: /Blog/archive*
Disallow: /Blog/archive.aspx
Disallow: /Blog/sitemap.axd
Disallow: /Blog/post.aspx But Allow everything below /Blog/Post The disallow list seems to keep growing as we find issues. So rather than adding in to our Robot.txt all the areas to disallow. Is there a way to easily just say Allow /Blog/Post and ignore the rest. How do we do that in Robot.txt Thanks0 -
Do i need to set up a reverse proxy?
Ahoy all, just through another audit - we have a terrible CMS which is ecommerce based only which doesnt allow us to blog or write much content, we have our blog as a seperate WP in our ftp panel and comes up as www.palicomp.co.uk/blog and our site is www.palicomp.co.uk - my question is do i need to set up a reverse proxy so this is classed as one site and my blog provides more value or would it only matter if it was set up as blog.palicomp.co.uk? Many thanks, Chris
Intermediate & Advanced SEO | | palicomp0 -
How related to your industry do your links need to be?
Hello, Some of the hottest link building techniques right now are guest posting, viral content, and link bating. But I often see SEOs produce content that has very little relevance to the actually industry they are in. For instance, a dentist might build links by guest posting on a tech site, an attorney might create an infographic on color psychology, and an accountant might venture into celebrity gossip. While more advanced SEOs try to make sure that the content they produce has some relevance to their industry (even if it's marginal), where is the line drawn?
Intermediate & Advanced SEO | | lezal0 -
How Does SEO Help Local Businesses
Hello, I recently took a position as a digital marketing manger with a advertising agency. Its my job to grow the digital marketing department. One of the issues I am running into is 90% of our clients are local businesses. When doing keyword research it is very difficult to find keywords with lots of search. For example, if I am optimizing for a Ford dealership in Hackensack,NJ there are not a lot of searches for this term. How can I justify a larger SEO budget when there is just not a lot of search volume for these keywords? This is nothing like Dog Training Videos or something similar. Am I missing something? Where can I pull traffic from for local businesses to justify larger SEO budgets? Thanks, Bill
Intermediate & Advanced SEO | | wparlaman0