Hi,
How can I redirect non-www url to www?
When I use www.my-domain.com it goes to my-domain.com.
But I want it to be always www.my-domain.com.
I have tried to add these three options (one by one), to my .htaccess but they dont work (website does not load):
RewriteCond %{HTTP_HOST} ^my-domain.com
RewriteRule (.*) http://www.my-domain.com/$1[R=301,L]
RewriteCond %{HTTP_HOST} ^my-domain.com [NC]
RewriteRule ^(.*)$ http://www.my-domain.com/$1[L,R=301]
RewriteCond %{http_host} ^my-domain.com [nc]
RewriteRule ^(.*)$ http://www.my-domain.com/$1[r=301,nc]
This is what I have in the .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_URI} .*\/aw2\.html
RewriteRule ^.*$ http://my-domain.com[L,R=301]
# Please note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon.
# Some hostings require RewriteBase to be uncommented
# Example:
# Your store url is http://www.yourcompany.com/store/cart
# So "RewriteBase" should be:
# RewriteBase /store/cart
RewriteBase /
Options -MultiViews
RewriteRule ^init.php$ - [F,L,NC]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
RewriteCond %{REQUEST_URI} .*/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*api/(.*)$ api.php?_d=$1 [L,QSA]
RewriteCond %{REQUEST_URI} \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]
RewriteCond %{REQUEST_URI} store_closed.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)\/(.*)$ $2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
Thank you very much for your help. =)