How Do You 301 Redirect?

3 replies
How do you do this to make it so that a www domain is the same a a non-www domain? I tried google and I'm still kinda confused so I thought I would ask here for a full tutorial. I'm using wordpress btw.
#301 #redirect
  • Profile picture of the author Mkj
    I think it is better to choose which one you want to use from the initial creation of your domain and site. That way you won't end up with duplicate content issues with Google and site indexing.

    There must be wordpress plugins for this but I would control this through htaccess normally with code like this:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.
    RewriteRule ^(.*)$ http://
    domain-name/$1 [R=301,L]

    The above will redirect any www request to a non www version of the site. The other method which would reverse this would be:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain-name [NC]
    RewriteRule ^(.*)$ http://www.domain-name/$1 [L,R=301]

    Do a search for a wordpress plugin though as this will make things a lot easier for you.
    {{ DiscussionBoard.errors[3968958].message }}
    • Profile picture of the author That Guy
      How do you choose from the beginning? I remember when I installed wordpress into my site I had to choose between www or non-www so does that mean that it's already done for me? Because When I do a google search of my keyword I get the non-www domain even though I picked the www domain at the start. Also when I use SEOquake to check the backlinks, I only backlink to the www version and because of this my non-www version has no indexed backlinks.
      {{ DiscussionBoard.errors[3969145].message }}
      • Profile picture of the author Mkj
        To choose from the beginning would mean using either htaccess or php to redirect to your choice - www or not. With the 301 redirects mentioned if a user adds www to an url and you elected to only use a non www url then they would be redirected to the non www url automatically.

        I don't know if wordpress redirects to your initial choice (maybe an option) but to see if your site is being redirected try your site url with www and without. For instance on my site if a user attempts to connect with my site using www in the url: Computer Software 4u they are automatically moved to the non url version: Computer Software 4u by the htaccess 301 redirect.

        Google will not penalize you for using a 301 redirect as it signifies that one or the other of your pages has permanently moved. It will stop duplicate pages being indexed though - which is a good thing, so using a 301 redirect at a later stage will help rather than harm a site.
        {{ DiscussionBoard.errors[3969805].message }}

Trending Topics