The best way to redirect to www
-
What is the best way to redirect non www to www. I saw a lot of the solution. is this one ok?
RewriteCond %{HTTP_HOST} !^www.seomoz.org [NC]
RewriteRule (.*) http://www.seomoz.org/$1 [L,R=301]
-
Glad you got it. The code I like to use:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]Of course, replacing "domain" with your own domain.
Let us know if you need any more help.
-
yes, a lot of people don't know that you should verify both the www and non www version of your site in Google Webmaster Tools!
-
This works:
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
and to select preferred domain name first I need to add non www version of the website and that's why I received an error.
You help me a lot!
-
What is the server error you are getting with the .htaccess file?
You do indeed need to verify ownership of you site, it's real easy to do, it involves adding a small piece of code to your site. See http://support.google.com/webmasters/bin/answer.py?hl=en&answer=35179 -
I got server error with .htaccess file and in webmaster tool message "Part of the process of setting a preferred domain is to verify that you own http://
-
That solution works just fine.
It looks like the one from the SEOmoz "Redirection SEO Best Practices"
I've never had any problems with it.
Also to keep things tidy, be sure to tell Google Webmaster Tools that your preferred domain is **www.**domain.com
GWMT -> configuration -> settings -> display URL's as www.domain.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
-
Best strategy for Researching for FAQ
Hi, I work for an eCommerce. I want to create a FAQ section on category pages with the question relative to that particular category. For Example -https://www.lockthedeal.com/catalog/energy/battery/four-wheeler?subcategory=Cars This is a sample URL for which I want to create a FAQ section.
On-Page Optimization | | RaviM
What would be the best way to do research for FAQs?0 -
Worth redirecting old blog posts into pages?
I'm working on a site that has some blog posts from 2011 - 2013 ranking on the first page for relevant terms. I'm going through and updating some of the content, internal links, etc., and wanted to know if it's worth redirecting some of these blog posts into new pages (in WordPress). Right now, the blog post URLs are long - exampleURL.com/2011/3/9/blog-post-title/ and the dates show up in the SERPs. I'd like to have the date removed so that the content doesn't look outdated, and I'd also like to have cleaner URLs. In your opinion, is it worth creating new pages and redirecting the old blog posts, or is the benefit of doing this not worth the effort? Thanks!
On-Page Optimization | | dchristensen30 -
Best practices when targeting a different country and language completely.
Hi, I have just recently built a shopping site which is targeting users from the UK, built in opencart. Now I want to expand the site and also target customers in Thailand, for Thailand users they will need the site in Thai & English language. I was wondering what would be the best option to do this, taking into account best possible practice V's time involved. As I can see it have only a couple of options really. 1. Add a new language to the existing .com site. This seems to be the easiest and fastest option. 2. Clone the site and launch on a .co.th domain with Thai/Eng text option. Would their be any major benefit ranking wise as to having a co.th separate site. Or any duplicate content potential issues. Bit of a noob so don't be afraid to point out the obvious. I did have search and could only find topics relating to eu languages and GB v US. Is their anything extra that has to be taken into account considering the massive differences between UK and Thai. Thanks you for any guidance, Ian
On-Page Optimization | | cookie7770 -
Is this good practise for SEO: www.example.com/testing-once/testing-once.aspx?
My web developer is telling me that it is best practice for SEO to place your keyword in your URL twice. For Example: www.example.com/testing-once/testing-once.aspx. I'm sure that this is not true, could you please help?
On-Page Optimization | | CoGri0 -
XML sitemap latest best practices?
If anyone optimised their sitemap recently and would like to share some tips it would be much appreciated:-) Cheers
On-Page Optimization | | dublinbet0 -
Does a www.domain.com/# count as a link?
Hi I thinking about consolidation some info from 5 pages onto 1 by using the hashtag at the end of the link to send people to the rigt section of the page. Does each link to the www.domain.com/# count as link so that I wont really gain any linkvalue by doing it?
On-Page Optimization | | home1110 -
Best article about internal linking structure?
Hi! Could you please recommend me a good and deep article about best practises in internal linking structure? I need to rethink the structure of a big site (lucky me it's very hierarchical) and I would like to have a look at some great articles about this to consolidate some ideas and have some new ones. I've read some but I would like some recommendations 🙂 Some articles about information architecture would be appreciated as well! Thanks!
On-Page Optimization | | jorgediaz0 -
Is the www and non www isue realy seen by Google as duplicate content?
I realy don't understand how Google could posibly devaluate a link because the site displays the same content with www and without www. I mean did somebody recently saw a devaluation of a domain because of this isue? I somehow can not belive this because it is the standard when geting a new webspace that the new website display the same content with and without www. Is a redirect realy necessary?
On-Page Optimization | | MichaelJanik0