开发者

Using .htaccess to house two websites in one hosting space

As the question suggests: I have two domains/websites and I want to use one shared hosting area to house them both.

One website/domain will run from the root... and the other will run from a folder situated inside root.

I've managed to get the htaccess file to do this but I need the url to be disguised so that the site that uses the folder appears to be its own domain name (instead of showing the other doma开发者_运维百科in name and folder its pointing to)

So the below...

Site1 -> site1.com Site2 -> site1.com/site2/

should be...

Site1 -> site1.com Site2 -> site2.com


RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub\-folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sub-folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteRule ^(/)?$ sub-folder/index.php [L]

It will just be a matter of using the rewrite engine so that the actual url doesn't show.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜