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
-
Ugly Redirect Chain
Hey everyone, Hoping to get your take on this: We have some very high demand products, they usually sell out in minutes (lucky us, eh?!) We are implementing a queue function on a product page - basically if too many people try to check out at the same time, we dump them in a queue The queue could kick in before or after search engines have indexed the product page The product page has markup and on-page content relating to the product. The queue page exists on an external (yes, external) site The queue page will not have any of the product info, markup, or optimised page title Product page will 302 to queue page and starts a series of 302 redirects! Here's the sequence when queue is active: CANONICAL product page (with markup, on-page product info, optimised page title, etc.)
Intermediate & Advanced SEO | | TSEOTEAM
>> 302 >> queue page on external domain (ZERO markup, product info or page title)
>>302>> same queue page, but throwing a hashed queue ID into the URL (basically giving you your place in the queue)
HELD IN QUEUE FOR A FEW MINUTES
**>> 302> ** NON-CANONICAL product page (with markup, on-page product info, optimised page title, etc.) I can foresee two scenarios search engine has indexed product page prior to queue kicking in. Then queue kicks in 302ing search engine to queue page. because it's a 302 the crappy queue page content is indexed back to the originating product page. This causes search engines to drop the product page cos all the product-specific markup/content has been overwritten with crappy queue page content search engines don't manage to index product page before queue kicks in. They crawl product page URL, get 302 to queue page, index crappy queue page content and think the product page is crappy, so don't traffic it. They will recrawl the product page once the queue's turned off, only to discover the product has sold out - boo. I very much doubt the search engines will 'wait for a few minutes' so may never end up reaching the product page again. I'm trying to get the markup/product info and optimised meta data injected into the queue page, so that remains present at all points on the journey in the hope that this enables search engines to continue to rank and traffic the product page. What's your take on this? Any suggestions on how we might overcome the issues? (before you ask; avoiding using the queue system is impossible, sorry!) Thanks!1 -
301 redirects broken - problems - please help!
Hi, I have a bit of an issue... Around a year ago we launched a new company. This company was launched out of a trading style of another company owned by our parent group (the trading style no longer exists). We used a lot of the content from the old trading style website, carefully mapping page-to-page 301 redirects, using the change of address tool in webmaster tools and generally did a good job of it. The reason I know we did a good job is that although we lost some traffic in the month we rebranded, we didn't lose rankings. We have since gained traffic exponentially and have managed to increase our organic traffic by over 200% over the last year. All well and good. However, a mistake has recently occurred whereby the old trading style website domain was deleted from the server for a period of around 2-3 weeks. It has since been reinstated. Since then, although we haven't lost rankings for the keywords we track I can see in webmaster tools that a number of our pages have been deindexed (around 100+). It has been suggested that we put the old homepage back up, and include a link to the XML sitemap to get Google to recrawl the old URLs and reinstate our 301 redirects. I'm OK with this (up to a point - personally I don't think it's an elegant solution) however I always thought you didn't need a link to the xml sitemap from the website and that the crawlers should just find it? Our current plan is not to put the homepage up exactly as it was (I don't believe this would make good business sense given that the company no longer exists), but to make it live with an explanation that the website has moved to a different domain with a big old button pointing to the new site. I'm wondering if we also need a button to the xml sitemap or not? I know I can put a sitemap link in the robots file, but I wonder if that would be enough for Google to find it? Any insights would be greatly appreciated. Thank you, Amelia
Intermediate & Advanced SEO | | CommT0 -
Should I redirect my xml sitemap?
Hi Mozzers, We have recently rebranded with a new company name, and of course this necessitated us to relaunch our entire website onto a new domain. I watched the Moz video on how they changed domain, copying what they did pretty much to the letter. (Thank you, Moz for sharing this with the community!) It has gone incredibly smoothly. I told all my bosses that we may see a 40% reduction in traffic / conversions in the short term. In the event (and its still very early days) we have in fact seen a 15% increase in traffic and our new website is converting better than before so an all-round success! I was just wondering if you thought I should redirect my XML sitemap as well? So far I haven't, but despite us doing the change of address thing in webmaster tools, I can see Google processed the old sitemap xml after we did the change of address etc. What do you think? I know we've been very lucky with the outcome of this rebrand but I don't want to rest on my laurels or get tripped up later down the line. Thanks everyone! Amelia
Intermediate & Advanced SEO | | CommT0 -
Homepage 302 Redirect For SSL
Hi All, My site, http://domain.com, currently has a 302 redirect from http://domain.com to https://domain.com. The reason we have an SSL cert is because we have a registration and log in form on the homepage (as well as log in options in the top bar of every page on the site - email/password). My question is: When taking SEO best practices into account, would we be better having a 301 redirect from http://domain.com to https://domain.com as most of our inbound links are directed to http://domain.com. Thanks for any help!
Intermediate & Advanced SEO | | Rogs.SEO0 -
Help Needed With .htaccess RewriteRule
Hello Fellow Mozzers, I would really appreciate a little help as I have been banging my head against a wall for the last few hours trying to create a .htaccess RewriteRule. I have around 300 URLs that I need to 301 redirect following a site re-build, they are in groups of similar urls but infortunately not broken down in to folders. Here is an example of a few URLs:- https://www.domain.co.uk/chamaecyparis-lawsoniana-ellwoodii_2.htm
Intermediate & Advanced SEO | | AdeLewis
https://www.domain.co.uk/chamaecyparis-lawsoniana-ellwoodii-200225cm-6670.htm
https://www.domain.co.uk/chamaecyparis-lawsoniana-ellwoodii.htm
https://www.domain.co.uk/chamaecyparis-lawsoniana-ellwoods-gold.htm
https://www.domain.co.uk/chamaecyparis-lawsoniana-lemon-queen.htm
https://www.domain.co.uk/chamaecyparis-lawsoniana-yvonne-200cm-66.htm All of the above URLs need to redirect to a new URL:- http://www.domain.co.uk/chamaecyparis-lawsoniana Here is the RewriteRule that I currently have but it isn't working:- RewriteEngine On
RewriteRule ^(.*)_chamaecyparis-lawsoniana$ https://www.domain.co.uk/chamaecyparis-lawsoniana [R=301,L] Anyone have any suggestions? Thanks
Ade.0 -
Redirection to mobile site
Calling all SEO ninjas! I'm currently developing single web pages for various clients which function as abbreviated versions of their main websites. They are all related & under a single domain. When a user visits these pages on a mobile device, CSS is used to display mobile friendly versions of these pages. My clients are thrilled with these mobile versions and now want to also redirect mobile visitors from their main site (which is not mobile optimised) to these pages. My questions are: Are there any negative implications if we did this? ie. redirecting to a different domain What is the best method for redirection? eg. JavaScript Can this be achieved by adding a single line of code to their main site Can this be done in an SEO friendly way so that the redirection acts like a backlink? Many thanks.
Intermediate & Advanced SEO | | martyc0 -
How can I create a redirection on IIS?
Hi, I want to know how to create a server side 301 redirection on IIS7. I found on google the below details; IIS Redirect In internet services manager, right click on the file or folder you wish to redirect Select the radio titled "a redirection to a URL". Enter the redirection page Check "The exact url entered above" and the "A permanent redirection for this resource" Click on 'Apply' But couldn't find anything like that. Can anyone help me out. thanks & regards
Intermediate & Advanced SEO | | VipinLouka780 -
Help with canonical tag
hello- i got this recommendation <dl> <dt>Recommendation</dt> <dd>Add a canonical URL tag referencing this URL to the header of the page</dd> <dd>from my "report card" and i see also that i have a lot of issues with duplicate content but i really dont have any duplicate content on my site.</dd> <dd>the crawl has apparently marked every post in my blog as duplicate page content.</dd> <dd>and the "use canonical tag" suggestion keeps appearing as a fix to my problems.</dd> <dd>could you please help me with ------How do i create a canonical tag?</dd> <dd>is it just rel=canonical?</dd> <dd>and where do i put it?</dd> <dd>i should put it on every page right?</dd> <dd>or with CSS my webmaster could probably do it very quickly right?</dd> <dd>i get the basic concept behind rel=canonical but i cant say i fully understand it -</dd> <dd>i need some help with regard to how and where this tag should be placed.</dd> <dd>thanks,</dd> <dd>erik
Intermediate & Advanced SEO | | Ezpro9
</dd> <dd>.</dd> </dl>0