Redirect url from non-www to www

I tried this solution

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

      

as in this stackoverflow question for redirect from non-www to www it works when i tried it on my pc also i checked the server header and it works fine (301) but when i tried it on my mobile phone (android Gingerbread) with Firefox and enter example.com

but the result is still example.com

not www.example.com

, it shouldn't be a problem as this is Server .

I do not use mobile redirection on the website, desktop version per device. I typed the code correctly.

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

      

What did I miss?

EDIT: Shoud I'm using a "mobile version" of .htaccess that I didn't know? Any advice would be great.

+3


source to share





All Articles