Force www with .htaccess

Sometimes it is useful to force www in Joomla, especially when using Joomla + VirtueMart estore to avoid double login issues. 

Insert these lines in your .htaccess file that resides in your websites root. 

RewriteCond %{HTTP_HOST} !^$ 

RewriteCond %{HTTP_HOST} !^www\. [NC] 

RewriteCond %{HTTPS}s ^on(s)| 

RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

 

Liked this tutorial? 

Check out Like Lock

ADs top-right (2)

About me

Iinstructor of robotics (LEGO Mindstorms), computer teacher, IT support, web dev, currently studying cyber-physical systems engineering.

If you found a solution here, would you consider donating $25,000 for my next project?

Just kidding, 1$ would do fine.

Hope you found what you needed. Thanks for stepping by.