canonical issues on my site

Discussion in 'Site & Server Administration' started by solardrift, Aug 29, 2010.

  1. #1
    I think I have a canonical issue going on on my site, and I want to try and fix it. I want to use the (http : // www...) form. But I'm a bit confused...

    I've been doing a bit of research on it, and I think I need to install a .htaccess file. I have no idea how to do this...

    Though, perhaps I can just use 301 redirect? I don't know how to do this either though...

    So I was wondering if anyone can advise which is easier, or better to do... and how I do it...

    Or, is there a wordpress plugin that can do it for me?

    Any info is appreciated, thanks.
     
    solardrift, Aug 29, 2010 IP
  2. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #2
    mcfox, Aug 29, 2010 IP
  3. solardrift

    solardrift Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh, OK... I didn't know that, and to be honest that sounds wayy tooo technical... LOL

    Thanks fo rthe link though, Iwill take a look at that, and see what i can do. I did notice there was a worpress plugin, but the consensus is that it is broken, so I'm not sure if it's worth tyring to instal it or not.

    Thanks for the reply mcfox.
     
    solardrift, Aug 30, 2010 IP
  4. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #4
    Yes, you would need to create an .htaccess file that would also work with Wordpress, which also uses .htaccess so it's a bit tricky. A plugin is probably the way to go. :)
     
    mcfox, Aug 31, 2010 IP
  5. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #5
    Here's the code for Wordpress in case you decide to go for it with htaccess. :) You need to replace the existing block of Wordpress code in your htaccess file with code below.

    Redirect www.domain to non-www.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Code (markup):
    and for non-www to www.domain


    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Code (markup):

    OR

    If you are comfortable editing the htaccess, just add the two lines under RewriteEngine On to the existing code.

    These:
    or these (depending on whether you want www. or not) see above:
     
    mcfox, Aug 31, 2010 IP
  6. solardrift

    solardrift Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for that Mcfox...

    It looks a bit complicated however... and I'm not so sure I can do it without f*&^ing it up!

    I may have to do a bit more homework. LOL
     
    solardrift, Sep 1, 2010 IP
  7. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #7
    Hehe. I know what you mean but the only way to learn is to have a go. :)

    Keep a copy of your htaccess file - rename it to htaccess-old or something so if it does go wrong all you need do is rename it back to .htaccess and you're good as new.
     
    mcfox, Sep 1, 2010 IP