Redirecting non-www pages to www ones
-
Hello:
I'm trying to consolidate all the link juice and see that some of my pages are linked to by using both www.mysite.com/whatever.html and mysite.com/whatever.html.
Is there a safe re-write rule that not just redirects non-www(s) to www(s), but designates the redirect as 301, so link juice will be transfered as well.If not RewriteRule, are there any other ways to accoplishe this?
And the last question: can this be solved by simply setting Preffered domain in google webmaster tools to display www URL?
Any help will be appreciated.
-
I also need to redirect my category pages from non-www to www. There is no option in Google web master tools for category pages, can you share with me exactly the code for my category page?????
-
thank you, that's what I need too, something I copy across multiple sites without having to change the domain URL every time. Appreciate your help.
-
also I use www. because it looks nicer, but its 6 of one and half a dozen of another....
-
The first one defines your url exactly so you can replace example.com with your own. The second one I used takes the http host variable from the header and fills it in for you.
In other words when a request is made to the site apache looks at the domain name and fills it in.
I use the second because it means there are large portions of my .htaccess file I can just copy and paste between multiple sites. As always there is more than one answer!!
Adam
-
what's the difference between:
RewriteRule (.) http://www.example.com/$1 [R=301,L] and
RewriteRule ^(.)$ http://www.%{HTTP_HOST}/$1 [R=301,L]any significance in using the root domain URL there instead of just www.%
-
This can be done within .htaccess. The code below should work -
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]The link juice will be transferred since it is a 301 redirect. And you can set your preferred domain within GWT but ideally you still want to use 301 redirects as well.
-
I would set the preferred domain in google webmaster tools to www. and do 301 redirects to www.
Webmaster tools will only effect how the link appears in search results, but not other external sources. Use the 301 redirect for that.
An example of one is
RewriteEngine On
non-WWW to WWW redirect
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]Hope it helps,
Adam
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
-
Non-optimised pages ranking higher than optimised homepage
I'm a developer working with a dating site and we're having what appear to be unusual ranking behaviour for the keyword "Ukraine Brides". When searching for "Ukraine Brides" we typically have the top 3 results in Google, however the homepage is almost never ranked #1. Other non-optimised pages appear ahead of it. I believe this is having a negative affect on our conversion rate, so wish to see this resolved. For instance, if you search here in NZ, the results are typically: Login page (/account/login) Search page (/search) Home page (/) Similar situation when searching in the US, but typically the top result is the search page. Is this unusual? We've spent quite a bit of time optimising the homepage, it has more external links, more internal links, better content that targets the keyword, more traffic, etc. Even so, the login and search pages appear higher. A side note, the average CTR for "Ukraine Brides" is significantly lower than "Ukraine Brides Agency" (20% vs 80% respectively), so I don't think that it's purely a 'brand keyword'. A few thoughts were: The search page is not accessible from the homepage unless you are logged in. Maybe this is causing some sort of linking/seo/ranking issue? Re: the login page being higher, perhaps many existing users visit the login page directly from this keyword in order to login straight away so Google pushes this to the top. I think this is less likely because most existing users will be logged in automatically (via cookies "remember me") and the homepage has a login form in anycase The site supports multiple languages. Maybe this is causing some canonical issues? There was an additional suggestion that we should noindex the login and search pages in order to resolve this ranking issue, but were nervous that we'd lose a large amount of organic clicks if we did this. Google must be doing this for a reason, so we wanted to resolve that underlying reason before dropping the noindex hammer. The fear is of course that we've done something wrong with our homepage which is causing it to perform poorly and thus these other pages rank higher. The hope would be that if we fixed that, that our rank for other keywords would improve also. It would be great if we could get some more eyes on this to hopefully confirm we're not doing anything silly, and are just generally after a second opinion.
Intermediate & Advanced SEO | | andrew_uba0 -
Our Web Site Is candere.com. Its PA and back link status are different for https://www.candere.com, http://www.candere.com, https://candere.com, and http://candere.com. Recently, we have completely move from http to https.
How can we fix it, so that we may mot lose ranking and authority.
Intermediate & Advanced SEO | | Dhananjayukumar0 -
Redirected Old Pages Still Indexed
Hello, we migrated a domain onto a new Wordpress site over a year ago. We redirected (with plugin: simple 301 redirects) all the old urls (.asp) to the corresponding new wordpress urls (non-.asp). The old pages are still indexed by Google, even though when you click on them you are redirected to the new page. Can someone tell me reasons they would still be indexed? Do you think it is hurting my rankings?
Intermediate & Advanced SEO | | phogan0 -
Should I merge these pages
I have this business and am not sure if I should have a separate page for all of the different roofing subservices or if i should put them all on one page. Even though they are separate, but related services, I feel they could end up competing against one another If I merge them I will also have more related and keyword rich content on one page that I could focus my efforts on.
Intermediate & Advanced SEO | | Atomicx0 -
Login required pages that redirect back to the post
Hi, Login required pages that redirect back to the post get the same description Example http://www.Somesite.com/modal/register?destination=post title Every post when a non member sees it has links that are as above post title is the only difference in the URL's So these Meta descriptions 1,000's of them are same. What can we do Thanks
Intermediate & Advanced SEO | | mtthompsons0 -
I have removed over 2000+ pages but Google still says i have 3000+ pages indexed
Good Afternoon, I run a office equipment website called top4office.co.uk. My predecessor decided that he would make an exact copy of the content on our existing site top4office.com and place it on the top4office.co.uk domain which included over 2k of thin pages. Since coming in i have hired a copywriter who has rewritten all the important content and I have removed over 2k pages of thin pages. I have set up 301's and blocked the thin pages using robots.txt and then used Google's removal tool to remove the pages from the index which was successfully done. But, although they were removed and can now longer be found in Google, when i use site:top4office.co.uk i still have over 3k of indexed pages (Originally i had 3700). Does anyone have any ideas why this is happening and more importantly how i can fix it? Our ranking on this site is woeful in comparison to what it was in 2011. I have a deadline and was wondering how quickly, in your opinion, do you think all these changes will impact my SERPs rankings? Look forward to your responses!
Intermediate & Advanced SEO | | apogeecorp0 -
Redirecting a redirect - thoughts?
Hi! A client has just had 14k 404s pop up in his WMT. I think this is because a page that they redirected to had moved. My question is, can I clean these up by redirecting the page the original redirect was one? If so, will it have any negative impact?
Intermediate & Advanced SEO | | neooptic0 -
301 Redirect pages with .aspx extension
I want 301 redirect all a website's subpages with a .aspx extension to a page without the .aspx etension. Example: I want to 301 redirect www.website.com/services.aspx to www.website.com/services Right now if you do not include .aspx on the end of every URL it gives a 404 error. I have used the web.config file to 301 redirect non-www to www and /default.aspx to /. I am not extremely familiar with IIS 7.0 or web.config, so any help would be great. Thanks.
Intermediate & Advanced SEO | | VentaMarketing0