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.

URL redirection with www

Discussion in 'Guidelines / Compliance' started by harihan, Aug 9, 2010.

  1. #1
    Hello,

    What should i do for redirecting my website in proper URL like http://www.mywebsite.com/ when anyone type website URL like mywebsite.com or www.mywebsite.com or http://mywebsite.com.

    Is there any need to contact website hosting server for that?


    Your quick reply will be appreciated.


    Thanks
    Sushila
     
    harihan, Aug 9, 2010 IP
  2. monfis

    monfis Well-Known Member

    Messages:
    1,476
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    160
    #2
    No need to contact your server. This is done with a simple .htaccess file.

    RewriteEngine On
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.htm\ HTTP/
    RewriteRule ^index\.htm$ http://www.yoursite.com/ [R=301,L]
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^yoursite.com$
    RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

    This one redirects the www.yoursite.com/index.htm/l to www.yoursite.com too.

    Replace htm with html or php or any file extension you use.
     
    monfis, Aug 9, 2010 IP
  3. harihan

    harihan Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks monfis for your quick reply.

    could you please answer me Where i have to put this code in the website?
     
    harihan, Aug 9, 2010 IP
  4. monfis

    monfis Well-Known Member

    Messages:
    1,476
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    160
    #4
    This code is not placed in the website. Place it in a simple text file with notepad or any simple text editor. save it and and name it .htaccess! (with the . dot in front) Then upload the file to the root directory (where your /index page is found). once uploaded you will not be able to see it but it's there, telling the server what to do. In case anything "goes wrong" just upload an empty file with the same name (.htaccess) this will overide any existing (wrong) file and you can start again with corrected code.
     
    monfis, Aug 9, 2010 IP