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
-
.htaccess redirect chains
At item 4 in the post at http://moz.com/blog/htaccess-file-snippets-for-seos the author recommends combining .htaccess redirects to avoid chaining redirects. I'd be obliged if someone could expand on: 1. What he means by chained redirects 2. How to combine the redirects per his recommendation Cheers.
On-Page Optimization | | ztalk1120 -
Best On page SEO guides needed.
I know my question looks so basic but let me explain what I want. I want advanced on-page SEO guides, should include something new exce[t the below listed things: title, description keyword in article content length video images with alt tag headings external authority links internal links please share something new....
On-Page Optimization | | hammadrafique0 -
Best wordpress theme seo 2014
In your opinion what are the best wordpress theme in 2014 that are responsive, good speed and seo buildup
On-Page Optimization | | maestrosonrisas0 -
URL best practices
Hi, I have a problem here, I used http://www.vietnamvisacorp.com/faqs.html instead of http://www.vietnamvisacorp.com/faqs. Hence, http://www.vietnamvisacorp.com/faqs will be caused 404 page. My question is should I change from faqs.html to faqs (no .html)? Thanks in advance any advice?
On-Page Optimization | | JohnHuynh0 -
I noticed that my company owns a few exact match domains that are relevant to our business. Is it worth doing anything other than just redirecting them to our homepage?
It turns out we own a few exact match domains that are relevant to our business. Is it worth doing anything other than just redirecting? (We have owned these sites for a long time, over 15 years.) The keywords are moderate to low in traffic and moderate to high in competitiveness. (Right now they 301 to our main site.) I know exact match is not as valuable as it used to be and that there are mixed opinions about microsites...
On-Page Optimization | | Linda-Vassily0 -
SEO Structure - Best Advice
Hi Mozzers, I'm wondering if I need to tweak my SEO friendly URL structure slightly. Example: http://www.vintageheirloom.com/vintage-celine/celine-bags would this be better for SEO if it was: http://www.vintageheirloom.com/vintage-celine/bags Perhaps the repetition of 'celine' is unnecesary, but OpenCart ecommerce CMS requires a plugin / modification to enable multiple use of a single term like e.g. 'bags'. Any benefit for $30? Thanks!
On-Page Optimization | | well-its-1-louder0 -
The best country specific strategy vs. an incumbent exact match domain
We are the single reseller in our country of a niche software, which has a quite general but non-competitive name. The name is already taken buy others in our country TLD, and in 1st rank. They are not related to our industry/business. Let's say our software is named blah, which could be the best country specific strategy we could have? Register a new country TLD domain with the blah in it? Something like blah-country.tdl. bl-ah.tdl? blah-software? Best Regards
On-Page Optimization | | wppseo0 -
What is the best duplicate content checker that will check by phrase?
I create a lot of landing pages for individual keywords on my site. An issue that I've run into is I unknowingly use some common phrases repeatedly on different pages and therefore sometimes get dinged by Google. I'm basically looking for a tool that would check the content of a new page against all the other pages on my site and check it phrase by phrase. Most of the tools I've found make you put in two URLs to check against - I need it to check against hundreds.
On-Page Optimization | | davegr0