I have referred all the related questions and tried answer given but its not working for my site.

In my .htaccess file, I have written below code to redirect non-www to www

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]

RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] 

Is there any settings in Joomla to be done, to work .htaccess file.

Thanks, in advance

Abhilasha Shah

Comments

Is mod_rewrite enabled?

Written by Shakti Singh

Yes Shakti, it is enabled and I have check this by using below code:

Written by Abhilasha Shah

RewriteEngine On Options +FollowSymLinks Redirect /google.html google.com

Written by Abhilasha Shah

when I use example.com, it shows Google Error-404 Not found Will there be any hosting issue?

Written by Abhilasha Shah

Accepted Answer

This is what I use -

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

The differences are minor but should make it work. This works completely outside the scope of Joomla, you shouldn't have to do anything to Joomla for this to work.

Written by Brent Friar
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki