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
-
Redirect Chains
Hi There, I have had conducted a few migrations recently and have a common issue which is this: HTTP (old site) -> HTTPS (old site) -> (HTTPS) (new site) Which causes a redirect chain. How should you prevent this before migration or fix it after migration? Cheers.
Intermediate & Advanced SEO | | kayl870 -
Need help with Robots.txt
An eCommerce site built with Modx CMS. I found lots of auto generated duplicate page issue on that site. Now I need to disallow some pages from that category. Here is the actual product page url looks like
Intermediate & Advanced SEO | | Nahid
product_listing.php?cat=6857 And here is the auto generated url structure
product_listing.php?cat=6857&cPath=dropship&size=19 Can any one suggest how to disallow this specific category through robots.txt. I am not so familiar with Modx and this kind of link structure. Your help will be appreciated. Thanks1 -
Will Schema help my website?
I'm doing SEO on a website, zing.co.nz, which is a soon to launch company. At the moment there is a splash sight up, which will be replaced by the real sight in a few weeks upon launch. Is it worth me putting in Schemas (for the first time) so that it is recognized as an organization? Will this effect us in the serps? Thanks for your help 🙂
Intermediate & Advanced SEO | | Startupfactory0 -
Fetch as Google - Redirected
Hi I have swaped from HTTP to HTTPS and put a redirect on for HTTP to redirect to HTTPS. I also put www.xyz.co.uk/index.html to redirect to www.xyz.co.uk When I fetch as Google it shows up redirect! Does this mean that I have too many 301 looping? Do I need the redirect on index.html to root domain if I have a rel conanical in place for index.html htaccess (Linix) - RewriteCond %{HTTP_HOST} ^xyz.co.uk
Intermediate & Advanced SEO | | Cocoonfxmedia
RewriteRule (.*) https://www.xyz.co.uk/$1 [R=301,L] RewriteRule ^$ index.html [R=301,L]0 -
302 redirects in the sitemap?
My website uses a prefix at the end to instruct the back-end about visitor details. The setup is similar to this site - http://sanfrancisco.giants.mlb.com/index.jsp?c_id=sf with a 302 redirect from the normal link to the one with additional info and a canonical tag on the actual URL without the extra info ((the normal one here being http://sanfrancisco.giants.mlb.com,) However, when I used www.xml-sitemaps.com to create a sitemap they did so using the URLs with the extra info on the links... what should I do to create a sitemap using the normal URLs (which are the ones I want to be promoting)
Intermediate & Advanced SEO | | theLotter0 -
How to decide on which site to 301 redirect
Hi there I'd like your opinions please! My client currently has their website at not-very-good-url.it which has a really good link profile they also have duplicate sites at: much-better-brand-name-url.it and much-better-brand-name-url.com but both these other sites have only a handful of links in. How important do you think a better brand url is? And therefore do you think it would be better to 301 to a better brand URL and take the risk that the link profile will get hit? Or leave the main site where it is and 301 the other two to it? Many thanks
Intermediate & Advanced SEO | | Chammy0 -
301 Redirect using rewrite rule in .htaccess
Hi guys, I have these types of URLs with the format below that are seen as duplicate contents http://www.mysite.com/index.php?a=11&b=15&d=3&c=1 I wanted to permanently redirect them to my homepage. I am thinking if this is possible in .htaccess using rewrite conditions? Thanks in advance...
Intermediate & Advanced SEO | | Trigun0 -
International IP redirection - help please!
Hi, We have a new client who has built a brand in the UK on a xyz.com domain. The "xyz.com" is now a brand and features on all marketing. Lots of SEO work has taken place and the UK site has good rankings and traffic. They have now expanded to the US and with offline marketing leading the way, xyz.com is the brand being pushed in the US. So with the launch of the offline marketing US IP's are now redirected to a US version of the site (subfolder) with relevant pricing and messaging. This is great for users, but with Googlebot being on a US IP it is also being redirected and the UK pages have now dropped out of the index. The solution we need would ideally have both UK and US users searching for xyz.com, but would see them land on respective static pages with correct prices. Ideally no link authority would be moved via redirection of users. We have considered the following solutions Move UK site to subfolder /uk and redirect UK ips to this subfolder (and so not googlebot) downside of this is it will massively impact the UK rankings which are the core driver of the business - also would this be deemed as illegal cloaking? natural links will always be to the xyz.com page and so longer term the US homepage will gain authority and UK homepage will be more reliant on artificial linkbuilding. Use a overlay that detects IP address and requests users to select relevant country (and cookies to redirect on second visit) this has been rejected by ecommerce team as will increase bounce rate% & we dont want users to be able to see other countries due to prduct and price differences. Use a homepage with country selection (and cookies to redirect on second visit) this has been rejected by ecommerce team as will increase bounce rate% & we dont want users to be able to see other countries due to prduct and price differences. Is there an easy solution to this problem that we're overlooking? Is there another way of legal cloaking we could use here? Many thanks in advance for any help here
Intermediate & Advanced SEO | | Red_Mud_Rookie0