SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Apache Server Canonical Redirect

    Hi guys,

    Need a little professional assistance... Canonical URLS

    I have just been reading about this and assume that 'every' site should combat this, right?

    Is there any risk of harming your existing page rank and SERPS?

    We have stupidly been allowing people to link to us using:
    http://www.domainname.com.au
    http://domainname.com.au
    http://www.domainname.com.au/store
    http://www.domainname.com.au/store/

    How can we find out where we stand on this in google results.... If we are suffering?

    I found 3 example codes for a htaccess solution but not sure which one to use. (we dont have any subdomains)

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

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


    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com.au
    RewriteRule (.*) http://www.yourdomain.com.au/$1 [R=301,L]
    Please confirm that this will in no way degrade our rankings.

    Thank you.

  2. #2
    Motivated Procrastinator seriocomic's Avatar
    Join Date
    Jan 2003
    Location
    Outside the bubble
    Posts
    1,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can confirm it will NOT degrade your rankings (provided that your redirects are set-up correctly).

    What this does in effect is consolidate all your backlinks that those variations have accumulated, so you should (depending on the number/nature of those backlinks) see a net benefit.

    As for the .htaccess bit, i am NOT an expert in redirections and regex, but this should work fine:
    Code:
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^example\.com$
    RewriteRule ^(.*) http://www.example.com/$1 [R=301]
    *if* you need to force the trailing slash (you must check that doing this won't break other parts of your site), then you can use the following .htaccess:
    Code:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://www.example.com/$1/ [R=301]
    Make sure you do some research or ask questions in the Apache forum to get the proper usage of the [L] qualifier so you don't end up in infinite redirects.

  3. #3
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply

    *if* you need to force the trailing slash
    Do I need to?

    Make sure you do some research or ask questions in the Apache forum to get the proper usage of the [L] qualifier so you don't end up in infinite redirects.
    Sorry, not sure what you mean


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •