Redirecting Joomla website from www URLs to Non-www easy with htaccess

Redirecting Joomla website from www URLs to Non-www easy with htaccess

To avoid duplicate content, website administrators should choose 1 of 2 types: have www or don't have www. Redirecting Joomla website from www URLs to Non-www using htaccess one of the steps of SEO optimization to increase ranking in Google

To use www.your-domain.com, you must point www to the hosting's IP with record A, and default www is also 1 sub-domain.

Open your htaccess file and find the line that reads:

RewriteEngine On

And add this code below it depends on the intention you want

#Redirect www to non-www:

RewriteCond %{HTTP_HOST} ^www.your-domain.com [NC]
RewriteRule ^(.*)$ http://your-domain.com/$1 [L,R=301]

Now when you access http://www.your-domain.com, you will be redirected to http://your-domain.com

#Redirect non-www to www:

RewriteCond %{HTTP_HOST} ^your-domain.com [NC]
RewriteRule ^(.*)$ http://www.your-domain.com/$1 [L,R=301]

Now when you access http://your-domain.com, you will be redirected to http://www.your-domain.com

Related Articles

Fast Joomla Templates & Premium Joomla Templates Provider

A provider of premium fast Joomla templates and offers weekly free Joomla templates and professional tutorials, tips for the Joomla website

Subscribe to our newsletter

Subscribe for our Joomla templates updates, tutorials, giveaways & more!
↑↑