1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to www.

Discussion in 'Site & Server Administration' started by DomainMagnate, Mar 10, 2006.

  1. #1
    Please don't call me stupid :eek:

    What's the easiest way to redirect all the pages to www.site.com, so for example site.com/some-stupid-keyword-spammed-page.html would be www.site.com/some-stupid-keyword-spammed-page.html

    Can you please give me a code to add to .httaccess and where should I add it exactly?
    SEMrush
    thanks :)
     
    DomainMagnate, Mar 10, 2006 IP
    SEMrush
  2. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add the following to .htaccess in your main web directory.

    
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^somedomain.com
    RewriteRule ^(.*) http://www.somedomain.com/$1 [R=301,L]
    
    Code (markup):
     
    petertdavis likes this.
  3. DomainMagnate

    DomainMagnate Illustrious Member

    Messages:
    10,932
    Likes Received:
    1,022
    Best Answers:
    0
    Trophy Points:
    455
    #3
    thanks, does it matter where I add it exactly?
    I've added at the end and it doesn't work, nothing changed..
     
    DomainMagnate, Mar 10, 2006 IP
  4. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, it has to be in the main web directory.
    This should be with the index file you have for your home page.

    Paste your current htaccess so I can see.

    Your host may not have this enabled.
     
  5. DomainMagnate

    DomainMagnate Illustrious Member

    Messages:
    10,932
    Likes Received:
    1,022
    Best Answers:
    0
    Trophy Points:
    455
    #5
    I'm using hostgator.
    I've checked it on another domain, there was no .htaccess file, so I've added it and yet no impact..
     
    DomainMagnate, Mar 10, 2006 IP
  6. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I don't see hostgator listing htaccess as available.
    I do believe that you have cPanel.
    You might have to add htaccess via cPanel.

    Search around cPanel and see if there is such an option.

    You may also want to try this similar code.
    Some server want to have / in there.


    
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^somedomain.com
    RewriteRule ^/(.*) http://www.somedomain.com/$1 [R=301,L]
    
    Code (markup):
     
    DomainMagnate likes this.
  7. DomainMagnate

    DomainMagnate Illustrious Member

    Messages:
    10,932
    Likes Received:
    1,022
    Best Answers:
    0
    Trophy Points:
    455
    #7
    ok, thanks, it works now :)

    I just forgot to change somedomain.com to my domain :p
    it's 3.30 a.m. here and I'm just tired..
     
    DomainMagnate, Mar 10, 2006 IP
  8. iowadawg

    iowadawg Prominent Member

    Messages:
    10,919
    Likes Received:
    811
    Best Answers:
    0
    Trophy Points:
    380
    #8
    I want to know why this would be done?
    If I put in xxxx.com in my browser window, it goes to the site.
    If I put in www.xxxx.com in my browser window, it goes to the site (same).
     
    iowadawg, Mar 10, 2006 IP
  9. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    xxx.com and www.xxx.com is viewed by search engines as 2 separate pages.

    Since the 2 pages would have exactly the same content, duplicate penalty may be imposed by search engines.

    With the 301, you send non-www to www so that everyone only see one page.

    A matter of preference really for some people.
     
  10. iowadawg

    iowadawg Prominent Member

    Messages:
    10,919
    Likes Received:
    811
    Best Answers:
    0
    Trophy Points:
    380
    #10
    So I just put the code shown in previous post in my htaccess file and all is right with the world of search engines?

    Thank you
     
    iowadawg, Mar 10, 2006 IP
  11. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #11

    Yes.

    That would definately kill duplicate content penalty or posibility of it being imposed.
     
  12. pairbrother

    pairbrother Well-Known Member

    Messages:
    386
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #12
    that means, we should add these lines of code in all of our sites .htaccess?

    also, i just checked .htaccess of one of my sites and it was blank-empty...is that ok?
     
    pairbrother, Mar 15, 2006 IP
  13. pairbrother

    pairbrother Well-Known Member

    Messages:
    386
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #13
    pairbrother, Mar 15, 2006 IP
  14. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14

    Yes, you should add to all your sites.
     
  15. SpeedyDomainRegistration

    SpeedyDomainRegistration Peon

    Messages:
    170
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #15

    That is precisely what happen when you can pull up a site with and without www. You should add the redirect code to htaccess file so that only www or non-www can be pull up. It is your choice in deciding which version you want to see in SE. If you use the redirect code, one of the version will eventually be deleted by the search engine.