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

Redirection in htaccess file don't work need help

Discussion in 'Black Hat SEO' started by Desert90, Nov 3, 2013.

  1. Desert90

    Desert90 Senior Member

    Joined:
    Sep 23, 2012
    Messages:
    926
    Likes Received:
    138
    Location:
    BHW
    I want to redirect my site like mydomain.com to http://www.mydomain.com but it doesn't work!

    i tried many options but nothing works. currently i am using this code but it won't work:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} (www\.)?mydomain.com
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]

    what i am doing wrong?
     
  2. Thesiege84

    Thesiege84 Regular Member

    Joined:
    May 5, 2009
    Messages:
    362
    Likes Received:
    97
    Occupation:
    Money Churner
    Location:
    Churning Money
    Not sure why above doesnt work but i always use:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
     
  3. Desert90

    Desert90 Senior Member

    Joined:
    Sep 23, 2012
    Messages:
    926
    Likes Received:
    138
    Location:
    BHW
    Thanks for the reply but your code also don't work :(
     
  4. Corrupted

    Corrupted Junior Member

    Joined:
    Nov 8, 2011
    Messages:
    158
    Likes Received:
    36
    Clean your cache and restart. Or test this with an anonymous browser. That code should work.
     
  5. winosergio

    winosergio Regular Member

    Joined:
    Mar 26, 2012
    Messages:
    274
    Likes Received:
    83
    Location:
    In my dreams
    If does not work, you maybe can redirect trough your cpanel hosting account.

    Maybe it can help you.

    Good luck
     
  6. rankedsites

    rankedsites Registered Member

    Joined:
    May 20, 2013
    Messages:
    69
    Likes Received:
    10
    Your problem is cache. The code above works as i use them on my sites
     
  7. herefornow

    herefornow Regular Member

    Joined:
    Sep 7, 2013
    Messages:
    217
    Likes Received:
    24
    Yep , I use the same also and it work fine , are you using wordpress ?
     
  8. Desert90

    Desert90 Senior Member

    Joined:
    Sep 23, 2012
    Messages:
    926
    Likes Received:
    138
    Location:
    BHW
    I cleaned my cookies and cache now firefox gives me a redirection error and my site can't load

    edit: no i use a html/css site

    edit 2: i reused the code of thesiege and cleaned my cache now it works thanks :)
     
    Last edited: Nov 3, 2013