Hello
I need your help. I want to test if the url is entered without www
like example.com it should be forwarded to www.example.com
Hello
I need your help. I want to test if the url is entered without www
like example.com it should be forwarded to www.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^.*$ http://www.example.com/$0 [NC,L,R=301]
Try this mod_rewrite rule:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]