Tag Archives: joomla

Adding www. to all links in Joomla CMS using .htaccess file

OK, this is simple one, and it will also work on other CMS/Websites, on this tutorial I used joomla with sef and apache mod rewrite enabled.

First of all you will need to navigate to your website root and than find file .htaccess (it’s hidden by default so be sure to have view hidden files enabled in your FTP client)…

Open file and check that “RewriteEngine On” is set before adding any rewrite rules.
Edit file and add RewriteCond and RewriteRule in custom redirects section like bellow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## Mod_rewrite in use.

RewriteEngine On
 
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 
## End - Custom redirects