php - Move main site into subfolder (htaccess) -


need organize several sites in 1 hosting account, putting each own folder.

via cpanel, completed , working add-on domains, main site (with subfolders) needs in own folder.

i have been doing via php:

example.com/index.php :

<?php     header('location: subdir/mainsite/index.php'); ?> 

the down side there page flash site redirects.

another downside url reflects new location in address bar:

http://example.com/subdir/mainsite/ 

i want visitors see http://example.com

i suspect can resolved using htaccess instead of php.

so, if domain is:

http://example.com 

and place main site files in:

public_html/_sub/mainsite 

and add-on sites must continue work...

what htaccess like?

this have far:

rewriteengine on rewritecond %{http_host} ^(www.)?example.com$ rewritecond %{request_uri} !^/_sub/mainsite/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /_sub/mainsite/$1 rewritecond %{http_host} ^(www.)?example.com$ rewriterule ^(/)?$ _sub/mainsite/index.php [l] 


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -