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
-
After 301 redirection non-English keyword points to English language pages
We had multilingual website on .co.uk domain and somewhere in April, we've done 301 redirection from domain1.co.uk pages which were in Polish language to domain2.com/pl domain and now for some Polish keywords Google SERP sometimes shows English pages (.com) and sometimes polish pages (.com/pl). Previously co.uk/en had English content and that got redirected to .com. What could be the reason? Thank you for all responses.
On-Page Optimization | | Optimal_Strategies0 -
Best practice to have gated white paper indexed by Google
Our main website white paper page has an image and brief description of the white paper. Once you click the white paper you are redirected to a form to access the gated white paper. Once you complete that form you are redirected to the white paper pdf which is housed on a subdomain/Hubspot. Because of this, I do not believe our website is getting "credit" for the keywords/content on these pages. Any suggestions on how we can allow the search engines to crawl this content while still keeping it gated? As I understand it a sub domain cannot hep or hurt (aside from critical crawler issues) the main domain. Thank you
On-Page Optimization | | NikCall0 -
How to redirect subdomain to new blog directory
I have moved my wordpress blog from a subdomain to a subdirectory /blog/ on my site. What is the best way to setup a redirect from the subdomain to the new /blog/ directory? Or should I just delete the subdomain blog and wait for google to index it on /blog/. I need to do one or the other so as not to run into duplicate content issues.
On-Page Optimization | | SamCUK0 -
Is there a way to prevent Google Alerts from picking up old press releases?
I have a client that wants a lot of old press releases (pdfs) added to their news page, but they don't want these to show up in Google Alerts. Is there a way for me to prevent this?
On-Page Optimization | | IdeaGarden0 -
What is the best tagline?
Please help me with the tagline: Option 1: Oasis of the Seas and Allure of the Seas Real Cruise Expert Option 2: Book Oasis of the Seas and Allure of the Seas with a Real
On-Page Optimization | | NadiaFL
Cruise Expert Option 3: No. 1 Cruise Expert: Oasis of the Seas and Allure of the
Seas Web page title: Oasis of the Seas and Allure of the Seas http://oasisoftheseasallureoftheseas.com/ Thank you!0 -
Is there a way to measure a competitors content growth?
Bonjour from 23 Degrees C hot & sultry Wetherby UK, I find again and again clients find jumping into an active volcano easier than addid fresh content. I want to try another tactic to prompt / scare them into adding content and here is my idea. I want to track a competitor site for a target term and monitor if they are adding content over time specific to that term. So my question is please: "Is there a reliable method to do this?" Ideas i had was doing a good old Google Title operator at the beginning of the month and then at monthly intervals to see if anything changes. Any insights welcome 🙂
On-Page Optimization | | Nightwing0 -
With or without the "www." ?
Is there any benefit whatsoever to having the www. in the URL? My domain is quite long therefore I've not been using the www. however a few people have mentioned it's good practice to include it. The www. forwards to the main URL (non www.) and I've set my preferred domain name in webmaster tools to the non www. so I'm thinking that should all be ok. Just hoping I could get some of the experts views to make sure this is all ok. The site is a year old and I'm just starting to really get going on the link building so it's not too late to change if I'm wrong. If others link to my site and include the www. will the link juice be passed, as I suspect many will include it without any thought?
On-Page Optimization | | Optimise0 -
Title optimization best practices for clients with insanely long business names
How do others utilize keywords and preserve branding in the title tag for clients with a REALLY long name? Two examples. Example 1: Business name is 38 characters long in the following format: [Firstname] [initial] [Lastname] [Businesstype] Services 38 characters is workable, but the keywords for what he offers and this industry in general are long too. He abbreviates to his initials in the domain name - I don't love doing that as the acronym has a meaning of its own. (We unintentionally acquired at least one very amusing if useless backlink thanks to that.) Leaving off "Services" saves a few characters. Example 2: Business name totals 58 characters and references their two related lines of business. Similar to: Rogers Institute of Robotic Studies and RIRS Robot Repair
On-Page Optimization | | MaryAnneG
or (saves a few characters)
Rogers Institute of Robotic Studies and Robot Repair How would you handle that? Use the appropriate half of the name on pages related to that particular LOB? Only use the brand on some pages? Abbreviate more? I've been using their full name on the more "general" pages of the site and omitting it in favor of keywords on the more specific pages . Suggestions? Other ideas?1