我又一次转向,所以当我在我束手无策。我的一个客户端上运行一个单一的托管计划三个独立的网站。 我需要做的是主域名的内容转移到子文件夹和主域名链接到它,这样
Once more I turn to SO when I am at my wits end. A client of mine is running three separate websites on a single hosting plan. What I need to do is shift the main domain contents to a sub-folder and link the main domain to it so that
maindomain.com/
实际上被链接到
actually gets linked to
/maindomain/
这我得到了正与
RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com/$
RewriteCond %{REQUEST_URI} !^/maindomain/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /maindomain/$1
RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$
RewriteRule ^(/)?$ maindomain/index.html [L]
第二部分是问题。我现在需要prevent插件域domainA中和域B从主domain.To被访问使问题更加复杂,domainA中运行了CakePHP,并即domainB正在运行一个自定义的框架,这是完全依赖于它的.htaccess
The Second part is the problem. I now need prevent addon domains domainA and domainB from being accessed from the main domain.To make matters more complicated, domainA is running cakePHP and domainB is running a custom framework which is totally dependent on its .htaccess
域存在于根目录的子文件夹,
the domains lie in sub-folders of webroot as
/domainA/
和
/domainB/
我尝试以下,但它并没有prevent进入附加域。
I tried the following but it didn't prevent access to the add-on domains.
RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/domainA/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/domainB/(.*)$ [OR]
RewriteRule ^(.*)$ - [L,R=404]
我真的可以用什么做的一些见解。
I could really use some insight on what to do.
把这个规则为在这两个是第一行 /domainA/.htaccess
和 /domainB/.htaccess
文件
Place this rule as very first rule in both /domainA/.htaccess
and /domainB/.htaccess
files:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$ [NC]
RewriteRule ^ - [L,R=404]