Difference between revisions of "Adding www to a url"

From Joomla! Documentation

(Previous code did not canonicalise www URLs with port number, nor direct IP requests. Use, see RFC 2606.)
m (Fixed typo in categorisation.)
Line 9: Line 9:

Revision as of 14:53, 7 March 2011

How do I get www as a prefix in all my joomla sites?

Add the following to your htaccess file

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