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
-
Redirect issue
http://www.themorrisagency.co.uk/wedding-band redirects to http://www.themorrisagency.co.uk/wedding-band-cost-much-hire/ NO canonical in place. Nothing in Htaccess. I cant think where else to look to find it. If I amend it to http://www.themorrisagency.co.uk/we it still redirects. Any ideas? I have spent way too long on it now
On-Page Optimization | | agentmorris10 -
What's the best way to host Videos on my Wordpress site? (SEO-wise)
I have a hard time choosing whether to stream my videos from certain platforms like vimeo, youtube, etc. or embedding the videos into my site, and I'm not quite sure which one Google would like to see more of? And which style will save my page speed from plummeting too much. Any ideas? Thanks guys
On-Page Optimization | | Benavest0 -
301 or Keep 2 Chocolate Best Sellers SEO?
Hi All, So we have two best selling organic chocolates that are very similar. http://www.santabarbarachocolate.com/bulk-organic-dark-chocolate-72-without-soy-lecithin/ and http://www.santabarbarachocolate.com/bulk-organic-dark-chocolate-72-without-soy-lecithin/ Because we are a small company it would be ideal to offer only one of these chocolates due to the cost of making it from the raw cacao. This is the question: From a SEO page rank perspective, do we get better rank by 301 redirecting one chocolate to the other thereby generating more traffic through traffic consolidation to one chocolate. Or do we get better SEO rank by having two chocolates on the site that both get clicks with different content? Basically it is a question of divided forces. Thanks for your help, Jason
On-Page Optimization | | santabarbarachocolate0 -
Duplicate content shown in Google webmaster tools for 301 redirected URLs.
Why does Google webmaster tools shows 5 URLs that have been 301 redirected as having duplicate meta descriptions?
On-Page Optimization | | Madlena0 -
How do I do a 301 Redirect in Wordpress
I have several pages that are showing up as "duplicate" on my Wordpress based site based upon the structure of site. I was wondering how to do a 301 redirect for these pages
On-Page Optimization | | SteveSweat0 -
What is the best way to manage industry required duplicate Important Safety Information (ISI) content on every page of a site?
Hello SEOmozzer! I have recently joined a large pharmaceutical marketing company as our head SEO guru, and I've encountered a duplicate content related issue here that I'd like some help on. Because there is so much red tape in the pharmaceutical industry, there are A LOT of limitations on website content, medication and drug claims, etc. Because of this, it is required to have Important Safety Information (ISI) clearly stated on every page of the client's website (including the homepage). The information is generally pretty lengthy, and in some cases is longer than the non-ISI content on each page. Here is an example: http://www.xifaxan.com/ All content under the ISI header is required on each page. My questions are: How will this duplicated content on each page affect our on-page optimization scores in the eyes of search engines? Is Google seeing this simply as duplicated content on every page, or are they "smart" enough to understand that because it is a drug website, this is industry standard (and required)? Aside from creating more meaty, non-ISI content for the site, are there any other suggestions you have for handling this potentially harmful SEO situation? And in case you were going to suggest it, we cannot simply have an image of the content, as it may not be visible by all internet users. We've already looked into that 😉 Thanks in advance! Dylan
On-Page Optimization | | MedThinkCommunications0 -
Best practice for Meta-Robots tag in categories and author pages?
For some of our site we use Wordpress, which we really like working with. The question I have is for the categories and authors pages (and similiar pages), i.e. the one looking: http://www.domain.com/authors/. Should you or should you not use follow, noindex for meta-robots? We have a lot of categories/tags/authors which generates a lot of pages. I'm a bit worried that google won't like this and leaning towards adding the follow, noindex. But the more I read about it, the more I see people disagree. What does the community of Seomoz think?
On-Page Optimization | | Lobtec0 -
Redirecting to an exact match root domain: good, bad, or neutral?
We have a client who wants to secure an exact match domain for their new website, but it's very long. They're wondering about securing an additional domain that is much shorter for marketing purposes (business cards, email addresses, etc). We would then 301 redirect the short domain to the main domain. Are we going to see negative SEO implications from that?
On-Page Optimization | | MackenzieFogelson1