1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Canonical URL Issue, need help

Discussion in 'White Hat SEO' started by aansy, Aug 28, 2011.

  1. aansy

    aansy Newbie

    Joined:
    Aug 6, 2011
    Messages:
    22
    Likes Received:
    2
    Occupation:
    Blogger
    Location:
    Anaheim
    Home Page:
    hi,

    My website in google webmaster tools is added with both non ww and with ww plus domain name and both are redirecting it to non ww. but when i browse it with ww, it does not redirect it to the non ww URL.

    All helpful suggestions will be highly appreciated.

    Thanks
     
  2. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    Modify htaccess to only work with non ww

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
    RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
     
    • Thanks Thanks x 1
  3. aansy

    aansy Newbie

    Joined:
    Aug 6, 2011
    Messages:
    22
    Likes Received:
    2
    Occupation:
    Blogger
    Location:
    Anaheim
    Home Page:
    after updating it with my domain name, i should put it on the httaccess file right. just these 3 code lines, right?
     
  4. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    Yep, just edit your domain in. If your htaccess file doesn't exist, just those 3 lines will do within a newly created htaccess file. If it exists, just prepend it to what's already in the file.

    Also, remember that it's ".htaccess" - spelled exactly like that, with the period included (a good way to view it if it's confusing is as a file with no file name and "htaccess" as the file extension).
     
  5. dlonnie98

    dlonnie98 Newbie

    Joined:
    Aug 27, 2011
    Messages:
    13
    Likes Received:
    0
    if your using wordpress for your blog its much easier. but if not then htaccess is the solution
     
  6. aansy

    aansy Newbie

    Joined:
    Aug 6, 2011
    Messages:
    22
    Likes Received:
    2
    Occupation:
    Blogger
    Location:
    Anaheim
    Home Page:
    the site is developed using Drupal.
     
  7. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    Were you able to get everything sorted to your needs?