www. & non-www. (fixing robots.text)

Discussion in 'robots.txt' started by theultimatepublishing, Jul 30, 2007.

  1. #1
    When I entered my main url (with www.), it gets redirected to a url (without www.). What happened to my www.?

    On some of my blog posts, such as this.

    When I clicked on my affiliate link, (which I used adtrackz to cloak), the www. also disappears!

    What happened? Is there a problem with my robots.text or .htaccess?

    Did I place my robots text in the wrong folder? I put in in the main folder & the /blog folder.

    Did I mess up the file permissions of my robots text or .htaccess?

    I would like redirect all the non-www. to www., how do I do that?

    Please help, thank you so much.
     
    theultimatepublishing, Jul 30, 2007 IP
  2. explorer

    explorer Well-Known Member

    Messages:
    463
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    110
    #2
    This is a .htaccess issue.

    To achieve what you want to do, place the following in your .htaccess.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourdomain\.com
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L]
     
    explorer, Jul 31, 2007 IP
  3. theultimatepublishing

    theultimatepublishing Peon

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks.

    Do I place this .htaccess file in the main folder or the /blog folder or both?
     
    theultimatepublishing, Jul 31, 2007 IP
  4. maxbear

    maxbear Active Member

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    Are you using wordpress? If yes, get the Permalink Redirect plugin, will fix all the problems.
     
    maxbear, Aug 1, 2007 IP
  5. theultimatepublishing

    theultimatepublishing Peon

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, I just did that few hours ago. Works fine now.
     
    theultimatepublishing, Aug 1, 2007 IP
  6. trichnosis

    trichnosis Prominent Member

    Messages:
    13,785
    Likes Received:
    333
    Best Answers:
    0
    Trophy Points:
    300
    #6
    it's better to make a 301 redirect with the code which is given above.

    dont waste your time with robots.txt
     
    trichnosis, Aug 6, 2007 IP