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 is the perfect way to handle multiple sitemaps index in Search Console?
Hello friends, I have this doubt for a long and i want to share it with you. In our agency many clients have a PHP template for the home page of their sites, and also have a blog with wordpress as CMS. When i am optimizing sitemaps, I have two separate files, an index of Sitemaps created with Wordpress SEO by Yoast (which inside has separate Sitemaps tags, categories, posts, pages, authors, etc.) and on the other hand the home page sitemap with the subsections. As you know the sitemap generated by "Wordpress SEO by Yoast" is dynamic as it creates the sitemap according to current site content, and is updated every time a new entry is raised or modify any URL. This makes it very practical. I can not have a unique index sitemap sitemaps nesting inside another, as it is not allowed by Google or Sitemap protocol. I read in the Google Support you can upload multiple sitemaps to Search Console but does not say anywhere on upload multiple sitemaps index, or a combination thereof. In my case, I would have to upload two separately files, the dynamically generated with wordpress and the manual created for the PHP template. In my opinion there is no problem and Google will index everything properly performing it this way, but I wanted to share it with you to see how you solve this problem and what experiences had. Thanks and best regards.
On-Page Optimization | | NachoRetta1 -
Using keywords in my URL: Doing a redirect to /keyword
My website in "On Page Grade" received an A.Anyway, I only have 1 thing to optimize:_"Use Keywords in your URL__Using your targeted keywords in the URL string adds relevancy to your page for search engine rankings, assists potential visitors identify the topic of your page from the URL, and provides SEO value when used as the anchor text of referring links."_My website is ranking in top10 for a super high competitive keyword and all my others competitors have the keyword on their domain, but not for my URL.Since I can't change my domain for fixing this suggestion, I would like to know what do you think about doing a 301 redirect from / to mydomainname.com/keyword/So the index of my website would be the /keyword.I don't know if this can make a damage to my SERP for the big change ir it would be a great choice.
On-Page Optimization | | estebanseo0 -
Should old pages that have being 301 redirected but have no/mimimal traffic be deleted?
In other words, I have pages from years ago that are redirected but how can I tell if traffic still flows through them? And if there is no or minimal traffic should the 301 be deleted? Linck
On-Page Optimization | | LinckB0 -
What is the best way to optimize industries served pages?
eg. abcwidgets.com/industries/durable-goods What kind of keywords should pages like these target? Primary service offered + industry name or the reverse order? Something else? Thanks for your feedback!
On-Page Optimization | | benjdonahower0 -
What is the best way to optimise a site that wants to target one service in multiple locations?
Hello! I would like to get some opinions about the best way to optimise a site/pages/URL's for a client that offers one service in multiple locations. The client has done work in various areas of the UK and wants to be found for these locations. They don't have addresses in these locations. What would be the best way to set up the pages/URLs for each location? Is there any reason why I can't have, for example, a main Portfolio page which has content about the service and a link to each portfolio in the different locations, e.g. /portfolio/london, /portfolio/hampstead, portfolio/kensington. Any advice would be very much appreciated. Thanks Kerry
On-Page Optimization | | Kerry_Jones1 -
Should we consider redirecting a high ranking subdomain page to our homepage?
My site bluecotton.com sells custom printed t-shirts. Our DA is 46. Our homepage is PA 55. The design studio is where users create their designs. Over the years the design studio has received a lot of fan fair including links from gizmodo and adobe. When I rank against our biggest competitors customink, ooshirts, uberprints.com I find that our domain as a whole doesn't look all that great. However, when I look at the history of our subdomain I see that we are more trusted and credible than all of our competitors. We have 10k links pointing to the design studio. Here is my question. What if I did 301 redirect of bluecotton.com/studio.html to bluecotton.com? Then I created a new url for the DS. This would not cause users any problems. In fact for many they would get more context around what we are trying to do and what we offer. Is this crazy? I never find results in google for the design studio. It always shows our home. That is pretty much what happens to all of our competitors on the higher traffic terms that are driving real sales. So why do i ask? If my subdomain is more valuable becuase of the design studio links then I wonder if I redirected it to the homepage if it would supercharge my homepage and propel is forward in the serps. Thoughts?
On-Page Optimization | | bradwayland0 -
What is the best out-of-the-box optimized WordPress Theme?
I've reviewed other answers on this forum and searched the web. Still looking for a good answer that's actually specific and can explain why. I've looked at studiopress.com themes, pagelines.com which I love but doesn't appear to have much optimization out of the box, http://themeforest.net/item/udesign-wordpress-theme/253220 http://www.vklabx.com/wordpress-themes/wordpress-theme-ad-flex-niche.php PS - not looking for answers that involve the use of SEO plugins, but if there's a theme you know of that takes minimal editing to improve optimization I'd be interested as well. Thanks in advance, hope this can help someone else as well
On-Page Optimization | | Aqua0 -
Redirect and page ranking
We used to have a good page rank of Google, but now our page rank dropped to zero. A few months ago we did a redirect from our www.???.com to non-www.???.com, because non-www.???.com is now our main website. We also have a number of other domains which we redirect to our main website non-www.???.com Do you think these redirects are causing the problem, and if so what can we do to fix it? Thanks!
On-Page Optimization | | poupette0