Need help with 301 Redirect www.site.com ---> http://site.com

5 replies
Hi

I am trying to create a 301 redirect from my wordpress site www.mysite.com ------> http://mysite.com

The advice at bluehost is useless, 3 people have told me all sorts.

After some research, I put this code in the htaccess file...


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


then i get an error in the browser when i test it on my site like this --

"The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

* This problem can sometimes be caused by disabling or refusing to accept
cookies."

Can someone please help me with this, because as you know, it's important due to SEO purposes.

Thanks
#&gt #> #301 #http or or sitecom #redirect #wwwsitecom
  • {{ DiscussionBoard.errors[1584832].message }}
    • Profile picture of the author TheWinner
      Originally Posted by dgarlock View Post

      Thanks for the article mate

      But I did perform that, but the same issue appears.

      Looks like I'll have to report back to the hosting company.

      Cheers
      {{ DiscussionBoard.errors[1584926].message }}
      • Profile picture of the author TheWinner
        Ok, after some time working on this, I have figured it out.

        To set up a 301 .htaccess redirect...Use this code...

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

        But.... Some wordpress htaccess files will have some code already, such as...

        # BEGIN WordPress

        some code here.....

        # END WordPress


        What you want to do, is at the end of the existing code....put the redirect code in like this...

        # BEGIN WordPress

        some code here.....

        # END WordPress


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


        That should do it. You can check in your "redirects" part of your cpanel if this is configured, and check by visiting the url that redirects.

        p.s. Make sure, your url that you want to work with is set up in wordpress (under Settings/general). e.g. if you want www.site to direct to http://site ... make sure the http://site is set up there, and vice versa... Otherwise, a loop error will occur. This is the issue I was having.

        All sorted now.

        Hope this helps anyone who needs it.

        Thanks
        {{ DiscussionBoard.errors[1588046].message }}
  • Profile picture of the author TPFLegionaire
    It worked brilliantly for me as well....thank you for figuring it out
    {{ DiscussionBoard.errors[2481937].message }}

Trending Topics