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
-
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 -
How can I redirect anything after the article url to main article?
Hello everyone, When someone visits my websites article like http://www.website.com/article-title/lol , it give to 404 page error. But when someone http://www.website.com/article-title/ , it shows the article. The word "lol" can be changed to anything. I would like that to be redirected to the main article. Example: Someone visits website.com/article-title/lol, they should be redirected to website.com/article-title/ Is it possible to do so? If yes, please tell me how. Note: I'm using WordPress Thank you
On-Page Optimization | | hakhan2011 -
Bold & Italics Best Practice?
Hi All, Does anyone know the official best practice use of bold and italic fonts? If I have a long page of text- 800 words + I usually bold a few sentences to allow the user to be able to read only the bold on the page, and still make sense of the article. By reading all the bold it will kind of make sense and the user gets the point of the article. This wasn't really done for SEO purposes, but so the reader gets to the bottom of the page in a reasonable amount of time, and gets all the key points and facts of the article. I was advised not to do this and to just bold/italic the keyword/phrases the article was written to rank for. I would like to know anyone else's opinion/strategy on using bold/italics effectively and within best practices. What's the official word? Thank you for your help. Ian
On-Page Optimization | | cookie7770 -
Will google regards www.example.com and www.example.com?331457 as the duplicate content?
Our site has some affiliates, and the affiliate id is the suffix following with the url "?xxxxxx". I can see Google Analytics regards www.example.com and www.example.com?331457 as the different page, but in fact they are exactly the same, the version www.example.com?331457 is the visit from our affiliate site. And yesterday I start up my Moz Pro membership, and in the crawl issues I see SEOMoz thinks www.example.com and www.example.com?331457 are duplicate content. Is this really an issue? Will the search engine thinks these two pages are duplicate content?? Thanks you guys My first question here, not too dumb I hope. -----------------Update---------------------- I should explain how our affiliates work. We are an eBook related software company, and anyone can apply an affiliate account on the transaction platform "RegNow" even without our permission because we have opened the affiliate door. When a visitor come to our order page from an affiliate site, the url will add the affiliate ID suffix "?xxxxxx", and it's combined in cookies. After the deal is done, the affiliate gets his commission. So no matter how I customize the url with URL Builder, there must be the suffix "?xxxxxx". It's the ID of our affiliate, or they will get nothing. So the key point is, will the suffix "?331457" makes Google think www.example.com and www.example.com?331457 are different pages and duplicate content?
On-Page Optimization | | JonnyGreenwood0 -
Massive 301 Permanant Redirects
Hello, First thing first, I am not moving my website to new domain neither changing my hosting. I just want to change internal page URLs to make them user and search engine friendly, URLs of categories and URLs of category filers. What I am talking about is massive 301 redirection. There are some pages which have backlinks and I have no doubt about using 301-permanant redirection for those pages. But as far as the category filter pages are concerned there are no backlinks for those pages, but yes they do have some authority. My website is 2months old. Now I want to know that Does massive redirection effects the website authority? Or avoid using permanent redirection for all pages instead use only for those pages which have back-links and avoid using for category filter pages. http://www.artorca.com/
On-Page Optimization | | MozAddict0 -
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 -
Blog on Subdomain vs. Subdirectory - Best Practices
Hi, I have recently been told that it no longer impacts authority or rankings if a blog is set up on a subdomain (blog.domain.com) rather than a subdirectory (/blog). However, I am reluctant to do so because I remember learning how blog subdomains did not adhere to SEO best practices. Would anyone be able to shed some light on the latest SEO best practices regarding this topic? Many thanks, Erin
On-Page Optimization | | HiddenPeak0 -
Long tail traffic - what is the best way to go back and add focus to repetitive long tail keywords?
Hey everybody, So, our niche doesn't have a million and a half searches per month, which makes a handle full of visitors look mighty enticing to a CMO Our price point is very high too, so to the question, is it worth taking the time to put a whole new content strategy in line for a few new visitors, the answer is yes. Now's the hard part. How on earth do I make 1,000 pages for similar topics? Is making new pages the best way to go about this? (probably so right? It's the only thing that I can see that would certainly increase likelihood of being more relevant, plus if I don't I will be missing out on the benefits of beefing up our site, AND the opportunity to more specifically answer a users query.) With phrases like "keyword" and "aftermarket keyword," the searcher is asking for two totally separate collections of results. I'm always reading about the importance of being there throughout the buyers complete purchasing /research process, which makes me think that considering doing anything other than creating unique pages is simply missing out.. Suggestions? Massive Content Strategy Help? Anybody? Thanks, TA
On-Page Optimization | | TylerAbernethy0