How to redirect from main site to subfolder

If you are trying to redirect from http://www.yourdomain.com to http://www.yourdomain.com/subdirectory/ this requires a special .htaccess config to avoid creating a loop.

You can use the following in the .htaccess of the main site.

Replace yourdomain.com with your own website, and replace newfolder with the name of the folder you want to redirect to.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
RewriteCond %{REQUEST_URI} !^/newfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /newfolder/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
RewriteRule ^(/)?$ newfolder/index.php [L]