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

Apache server htaccess to redirect http:// to http://www

Discussion in 'Black Hat SEO' started by maxlinks, Jan 27, 2012.

  1. maxlinks

    maxlinks Junior Member

    Joined:
    Jul 4, 2011
    Messages:
    161
    Likes Received:
    5
    Occupation:
    sit at the desk all day
    Location:
    Los Angeles
    I forgot how to do that,

    what is the command I put in the htaccess file ?
     
  2. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
  3. confined

    confined Regular Member

    Joined:
    Jan 4, 2009
    Messages:
    216
    Likes Received:
    91
    I would change R=301 in the last line, and don't forget

    Code:
     RewriteEngine on
    
    at the beginning of the .htaccess file.

    so the whole thing would look like

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^mysite\.com
    RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
    
     
  4. maxlinks

    maxlinks Junior Member

    Joined:
    Jul 4, 2011
    Messages:
    161
    Likes Received:
    5
    Occupation:
    sit at the desk all day
    Location:
    Los Angeles
    sorry to ask dumb question but do I post it exactly like you mentioned or do I add my website path ?
     
  5. maxlinks

    maxlinks Junior Member

    Joined:
    Jul 4, 2011
    Messages:
    161
    Likes Received:
    5
    Occupation:
    sit at the desk all day
    Location:
    Los Angeles
    never mind, I tried , and it worked perfectly , thank you

    RewriteEngine on RewriteCond %{HTTP_HOST} ^mysite\.com RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
     
  6. maxlinks

    maxlinks Junior Member

    Joined:
    Jul 4, 2011
    Messages:
    161
    Likes Received:
    5
    Occupation:
    sit at the desk all day
    Location:
    Los Angeles
    sorry that was premature , it didnt work, so should I be entering my web site address in there ?
     
  7. maxlinks

    maxlinks Junior Member

    Joined:
    Jul 4, 2011
    Messages:
    161
    Likes Received:
    5
    Occupation:
    sit at the desk all day
    Location:
    Los Angeles
    maybe I need to rephrase my question:

    ok I changed the 000-default file in the sites enabled directory of apache to make my website point to www.xxxx.com not just http://xxxx.com,
    so that works my site can be found when typing www.xxxx.com

    but when I type http://xxxx.com it goes to the default web site on the server, thats not good, as I have many sites on the server.

    so what should I do to make my sites work on both www.xxx.com and http://xxxx.com
    at the very least I dont want people typing http://xxx.com and getting an entirely dierent web site (the default site)