I'm trying to redirect www.example.com
to http://example.com
using the .htaccess
file in my root directory.
I've tried the examples listed here and elsewhere. rewriteengine
is on.
rewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
rewriteRule (.*) //%1/$1 [L,R=301]
I've plugged this in in different spots of my .htaccess
file, and I get redirect errors, saying it's improperly redirected.
In the above example, do I need to plug my actual site information in somewhere? If so, can someone give me an example using www.example.com
?
I'm on a Linux based server, through GoDaddy.
RewriteRule
substitution. It's simply seen as relative to the document root (as is any URL that starts with a slash).