1

Does anyone have the setttings from the .htaccess file to remove www from my url?

http://example.com

I've tried using some of the settings in the internet but it gives me a redirect loop. I need something that prevents a redirect loop.

this would really help me. thank you

rj tubera
  • 747
  • 4
  • 29
  • 51
  • 1
    possible duplicate of [apache redirect from non www to www](http://stackoverflow.com/questions/1100343/apache-redirect-from-non-www-to-www) – marcanuy Sep 04 '14 at 14:58
  • Hi, right now our goal does not involve Apache. Thanks for answer though :) – rj tubera Sep 05 '14 at 12:34

1 Answers1

1

You can put this code in your htaccess

RewriteEngine On

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

If you're still having a redirect loop:

  • you have maybe another script that redirects non-www to www
  • old rule still in browser's cache (try cleaning cache or with another browser)
Justin Iurman
  • 18,954
  • 3
  • 35
  • 54