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
-
Combining products - edit existing product page or 301 redirect to new page?
We want to combine existing products - e.g. 'hand lotion' and 'body lotion' will become 'hand & body lotion'. As such, we'll need to combine the two product pages into one. What would be the best route to take in terms of SEO to do this? My initial reaction is to create a new product page and then 301 or 302 redirect the old products to the new product page depending on if the change is permanent or temporary. Would you agree? Or am I missing something?
On-Page Optimization | | SwankyApple1 -
Best site structure for us?
Hey guys, I have a somewhat silly question that I probably know the answer to - but would still like to hear your POV's. We're a WP theme making company but we also build other stuff. Context: 1. All demos for themes currently go under domain.com/Theme_A/ The demo is lorem ipsum so is marked noindex nofollow. That being said we get rocking analytics data usually (not sure if it's still valuable for G after the noindex). 2. Currently we need landing pages for themes and we're running them under domain.com/Theme_A/optimized-landing-page-title.php dofollow and indexed ofc. My question is...Would we be better off to include all landing pages under a domain.com/wordpress-themes/ category/tax and then go for the optimized-landing-page-title.php page? Does it make any difference either or? Right now we're not REALLY running them on subdomains (though the structure seems like it), they're just folders. We're thinking that more seo juice would flow through the different pages if we have them all under the same category, rather than basically starting from scratch each time under a new folder. Right? Thanks!!!
On-Page Optimization | | andy.bigbangthemes1 -
Best way to optimize a website for local search today?
A real estate agent client has had a website for years, which he optimized to position himself as a national real estate expert (to get more TV and media exposure). Now he wants to be found for a more local real estate term, such as Westchester ny real estate. Should he add a page to his site that's focused on Westchester real estate, or would Google view that as spammy? Should he update older blog posts with relevant, useful content about Westchester? Any best practices and suggestions would be greatly appreciated. Thank you.
On-Page Optimization | | JimMartinSF0 -
What is the best way to block http://www.site.com/members/...
How do i block http://www.site.com/members/....name/activity/3202 and many more like this from getting spider showing up as duplicate in moz Regards Tai
On-Page Optimization | | Taiger0 -
I am trying to better understand solving the duplicate content issues highlighted in your recent crawl report of our site - www.thehomesites.com.
Below are some of the urls highlighted as having duplicate content -
On-Page Optimization | | urahul
http://www.thehomesites.com/zip_details/76105
http://www.thehomesites.com/zip_details/44135
http://www.thehomesites.com/zip_details/75227
http://www.thehomesites.com/zip_details/94501 These are neighborhood reports generated for 4 different zip codes. We use a standard template to create these reports. What are some of the steps we can take to avoid these pages being categorized as duplicate content?0 -
Redirect www.domain to domain
How do I redirect www.entrepreneurhandbook.co.uk to entrepreneurhandbook.co.uk The latter is an existing site. Thanks James
On-Page Optimization | | entrepreneurhandbook1 -
Making best use of keyword phrase domain url
Hi everyone Our industry has a particular keyword phrase that is very popular. We currently own this as a domain name. How can we make use of this to our main websites advantage?
On-Page Optimization | | LadyApollo0 -
Which is better, a directory 301 redirect or each page in the directory?
A customer of mine has a site with lots of articles and they are all quite spammy. They have not been affected by penguin yet so they asked what to do. I suggested losing the articles directory and 301 redirect to either the home page or another important page. Would a 301 redirect on the entire directory to a single page be the way to go or add redirects from each page within the directory and spread out redirects to various pages in website? Or do you have a better suggestion?
On-Page Optimization | | anthonytjm0