I pretty much know nothing about about .htaccess editing or regex expressions. What I have done to try to make my site re-direct from www
versions to non-www
versions is I followed the answers posted here:
However, what I get is that if I enter www.example.com
, I get:
example.com/example.com/
and a 404 error on my site
This is my .htaccess file:
#Adjust default time zone
SetEnv TZ America/Toronto
#Begin redirect www to non-www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]
# Google Analytics Integration - Added by cPanel.
<IfModule mod_substitute.c>
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|(<script src='/google_analytics_auto.js'></script>)?</head>|<script src='/google_analytics_auto.js'></script></head>|i"
</IfModule>
# END Google Analytics Integration
Can someone enlighten me on what I am doing wrong?