Need to redirect http://domain.com to http://domain.com/subfolder/

Discussions related with hosting control panels used, which include cPanel, Plesk, Directadmin etc..
Post Reply
sachin
Posts: 0
Joined: Thu Mar 31, 2016 8:33 am

Need to redirect http://domain.com to http://domain.com/subfolder/

Post by sachin »

Hi there,

Trying to redirect http://domain.com to http://domain.com/subfolder/

Please help.



jamest
Posts: 0
Joined: Thu Mar 31, 2016 8:19 am

Re: Need to redirect http://domain.com to http://domain.com/subfolder/

Post by jamest »

Add the following rule to .htaccess in the main account.

RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subfolder/$1


If not working, try adding redirect from cPanel

cPanel > Redirects > Add redirect to the directory.



sachin
Posts: 0
Joined: Thu Mar 31, 2016 8:33 am

Re: Need to redirect http://domain.com to http://domain.com/subfolder/

Post by sachin »

htaccess rule worked. Thanks man :)



Post Reply