301 redirects how and why

Discussion in 'Search Engine Optimization' started by saturn100, Aug 13, 2009.

  1. #1
    I was reading some stuff yesterday about 301 redirects and SEO
    It mentioned I should set up a redirect between
    www.mydoamain.com and mydomain.com so each have the same juice
    I dont get this how do I set up such a redirect and how is it helpful
    What does this mean
     
    saturn100, Aug 13, 2009 IP
  2. Smart_sdr

    Smart_sdr Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why don't you use from your control's panel from your hosting the alias, add alias record for www
     
    Smart_sdr, Aug 13, 2009 IP
  3. justkidding

    justkidding Active Member

    Messages:
    937
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    you can also set it from google webmaster tool but that will be limited to google only. if you are a programmer, take all the request coming in and see if it is with www. or not, if not then add it and make a 301 to same.
     
    justkidding, Aug 13, 2009 IP
  4. saturn100

    saturn100 Well-Known Member

    Messages:
    465
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #4
    I am sorry what
     
    saturn100, Aug 13, 2009 IP
  5. Canonical

    Canonical Well-Known Member

    Messages:
    2,223
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Perhaps this previous post of mine will explain "why" you need to do it:

    As far as "how" to do it, you have several options... The option you pick depends on whether you are hosted on an Apache web server and whether your site is written using a server-side scripting language.

    If you are hosted on an Apache web server and understand regular expression then I would suggest implementing the 301 redirect rules for enforcing site-wide canonical URLs using Mod Rewrite / .htaccess files. You can find examples all over the web.

    For example you might force all URLs to include www with something like the following in your root .htaccess:

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    or get rid of index.html off the end of your URLs with something like the following in your root .htaccess:

    RewriteCond $1 ((.*)/)index\.html [NC]
    RewriteRule (.*) http://www.example.com/%2 [R=301,L]

    DISCLAIMER: I'm winging the Mod Rewrite on the fly... so it's NOT tested and just to show you what it looks like.

    As an ABSOLUTE last resort you can use a <link rel="canonical" href="your canonical URL"> in the <head> of each page to tell the 3 major engines what you want your canonical URL for that page to be. But this is NOWHERE near as good as using 301 redirects. This recently added version of the <link> element was really meant for sites where implementing canonicals w/ 301 redirects is VERY difficult (like huge ecommerce sites) or HTML sites hosted on IIS (don't have access to Mod Rewrite or server side scripting).
     
    Canonical, Aug 13, 2009 IP
  6. willybfriendly

    willybfriendly Peon

    Messages:
    700
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #6
    www.example.com and example.com are seen by the SE's as two distinct pages/urls (as are www.example.com/index.htm, example.com/index.htm and/or any other url that resolves to the same content).

    All should be permanently (i.e. 301) redirected to the url of your choice.

    Techniques for accomplishing this are platform dependent. On Apache servers it is most often done via .htaccess, although it can be done in htpdconf. Windoze servers require ISAPI rewrite.

    It is not hard to find tutorials if you google. It can differ a bit depending on server configuration, but an example for .htaccess might look like:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

    You will need to redirect all possible alternate urls to the canonical url.

    Other solutions can be used, including PHP or other server side languages.
     
    willybfriendly, Aug 13, 2009 IP
  7. willybfriendly

    willybfriendly Peon

    Messages:
    700
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well shucks, Canonical, you were posting as I was writing...:mad:
     
    willybfriendly, Aug 13, 2009 IP
  8. Canonical

    Canonical Well-Known Member

    Messages:
    2,223
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Great minds think alike! hehe ;)
     
    Canonical, Aug 13, 2009 IP