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

redirecting http://-----to only http://www---

Discussion in 'White Hat SEO' started by louisp2500, Aug 14, 2014.

  1. louisp2500

    louisp2500 Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    371
    Likes Received:
    58
    Can someone help me how to redirect my site to only show up with http://www and NOT without www?

    My site is just a simple HTML site, no wordpress or joomla or anything else, just HTML

    thanks in advance :)
     
  2. vlaci

    vlaci Junior Member

    Joined:
    Sep 2, 2013
    Messages:
    120
    Likes Received:
    37
    Hi,

    1.First of all create a file in notepad named htaccess.txt on your desktop.

    2.add the following code in this file -
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    3.Upload it to the root of your website

    4.rename htaccess.txt to .htaccess

    This should be ok.
     
  3. louisp2500

    louisp2500 Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    371
    Likes Received:
    58
    i have just gone from windows to mac, what can i use as notepad on a mac?
     
  4. louisp2500

    louisp2500 Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    371
    Likes Received:
    58
    i have just done it, but it didnt seem to work, i have contactet my serverprovider
     
  5. M4XW3LL

    M4XW3LL Senior Member

    Joined:
    Feb 5, 2013
    Messages:
    1,052
    Likes Received:
    1,247
  6. louisp2500

    louisp2500 Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    371
    Likes Received:
    58
    Thanks, but i cant seem to get it working
     
  7. rankwatch12

    rankwatch12 Regular Member

    Joined:
    Jun 19, 2014
    Messages:
    235
    Likes Received:
    13
    Home Page:
    You can try to create htaccess file via bbedit on Mac. Add the following code in it, save it as .txt file and upload it in the default site directory.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
     
  8. Aty

    Aty Jr. VIP Jr. VIP

    Joined:
    Jan 27, 2011
    Messages:
    5,407
    Likes Received:
    3,698
    Home Page:
    Try this:

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase / 
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    
     
  9. leo29

    leo29 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jun 23, 2014
    Messages:
    128
    Likes Received:
    17
    Gender:
    Male
    If 301 redirection seems that difficult, you can use rel=canonical in your header section
    below all the meta data in the header section, you can type
    <link rel="canonical" href="http://www.____">.
    This wont remove your http://________ page but it requests google to consider only the page with canonical tag.