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
-
How do I redirect SEO from pages on old website to new website with new domain name?
How do I redirect SEO from pages on old website to new website with new domain name? My website in squarespace has good rankings and we have rebranded to a new name and enw domain name, how do I move across the rankings fomr the old site in squarespace to my new site thats in wordpress please?
On-Page Optimization | | Carrotpower0 -
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 -
301 Redirect and SEO Rankings
I recently restructured my webpage URL's (about 300 ~ 75% of my total website) to make the URL paths more SEO friendly. Within a few hours of restructuring the pages, I did a 301 redirect to my old URL's and pointed them to the new pages. I have seen ~ 50% drop in organic traffic. I started the restructuring exercise 14 days ago and finished it a few hours back. I have 3 questions: How long will it take for me to recover my old traffic. Will I recover most of it or some of it? Due to a glitch in the specified path, some old URL's were wrongly redirected (this happened with 9 pages to be exact). I will explain exactly what happened: www.redirct.com/superseonow1 ---- redirected to ---- www.redirectnow.com/seonow1 **/superseonow was 301 redirected to /seonow. After 3 days I realize that /superseonow1 was actually /supernow1. The same thing happened to 9 pages - /superseonow2, /superseonow3 ..... ** I have removed all the wrong redirects. When I tried to enter the correct (old) paths now and 301 redirect them to the new paths, the page was not found using the old paths. Should I redirect the old paths to the New ones even now? 3. Finally, in how much time after you change the page structure should you use the 301 redirect. Since I had two different teams working on this job, there could have been up to a 24 hour gap between the redirection.
On-Page Optimization | | rajatsharma0 -
Best practice for Portfolio Links
I have a client with a really large project portfolio (over 500 project images), which causes their portfolio page to have well over the 100 links that are recommended. How can I reduce this without reducing the number of photos they can upload?
On-Page Optimization | | HochKaren0 -
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 -
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 -
On my site, www.myagingfolks.com, only a small number of my pages appear to be indexed by google or yahoo. Is that due to not having an XML sitemap, keywords, or some other problem?
On my site, www.myagingfolks.com, only a small number of my pages appear to be indexed by google or yahoo. I have thousands of pages! Is that due to not having an XML sitemap, keywords, or some other problem?
On-Page Optimization | | Jordanrg0 -
Login Page Redirection
Hello, I have certain pages on my site which are login only. Am wondering if a user reaches that page, should I send him to a 301 redirect to a new login page? or some other form of redirection? Any suggestions on how to best tackle this situation? Update If I redirect to a login.php page, then what kind of redirection should I use? Thank you for your time, Anant
On-Page Optimization | | anantgarg0