Search code examples
urlwebjoomlavirtuemart

How can I force a URL to have "www." no matter what?


I'm using Joomla 1.5 and Virtuemart 1. It might seem like a weird question but I need my URL to have "www." written in the URL at all times. If the URL doesn't have "www." then the cart functions don't work. If it does have it, then it does work.

Is there a way I can force this? I am using Parallels Plesk 10.3.1 if I can do it on there.


Solution

  • if your server is running on apache, you can add a .htaccess file to your root webdirectory with the following content:

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