how to setup 301 redirect from non-www to www and subfolder

I wanted to redirect our website to i.e. two redirects as below,
1. to [ non-www to www ]
2. or to [ from root to subfolder of root ]

Here is what .htaccess solved the problem,

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

RewriteEngine On
RewriteRule ^$ /fconn [L]

The first RewriteEngine does is do 301 redirect from to
and second RewriteEngine does is redirect to

How to verify your websites current redirects,
Just type your domain name in and click Trace, or you can also use


For more help refer below URLs :

You can also refer to good information at


Leave a Reply