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.

301 redirect from WWW to NON WWW causes redirection loop! How can I fix this?

Discussion in 'Apache' started by eXPerience2010, Apr 19, 2011.

  1. #1
    Hello. Can someone please help me set up a 301 redirect from WWW to NON WWW.
    I really need to do this for search engine optimising purposes.
    I would like to redirect the WWW to the NON WWW (not the other way round).
    I need my site to reside on http://amonestar.com NOT ON http://WWW.amonestar.com

    This is the error I keep getting when I try to set up the redirect in cPanel.
    SEMrush
    You cannot redirect to http://amonestar.com as will cause a redirection loop because /home3/amonesta/public_html/ is at the same place as /home3/amonesta/public_html/.
    Code (markup):
    I have also tried setting up the redirect via a .htaccess file and then placing that .htaccess file in the public_html folder. However this also doesn't work. :confused:

    This is the code I used in the .htaccess file:

    RewriteEngine On
    RewriteCond % ^www.amonestar.com [NC]
    RewriteRule ^(.*)$ http://amonestar.com/$1 [L,R=301]
    
    Code (markup):
    Could someone please tell me what I'm doing wrong. I have read countless numbers of tutorials online about this. I just can't seem to get it to work. :confused:

    I hope I don't need root access or something because I don't have root access. :confused:

    I really need to set up this permanent 301 redirect. Please help! :confused:

    UPDATE:

    I seem to have fixed this after reading some very helpful posts on this forum.
    I will post back if I have any further problems. But for now the redirect loop seems to have gone and the site is now redirecting from the WWW to the NON WWW.

    This is the code I used:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^amonestar\.com
    RewriteRule ^(.*)$  http://amonestar.com/$1 [R=301,L]
    Code (markup):
     
    Last edited: Apr 19, 2011
    eXPerience2010, Apr 19, 2011 IP
    SEMrush
  2. knowledgeherald

    knowledgeherald Well-Known Member

    Messages:
    544
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    120
    #2
    One of my sites don't open without "www". Don't know why. I think need to use the same code. My site is hosted on blogger and not having 'blogspot' in the domain name. Have my own choice domain.
     
    knowledgeherald, Jan 7, 2018 IP