2012-11-30 107 views
2

我的主机上有几个网站。他们中的大多数都有自己的域名。防止访问主域名上的子域名的文件夹

我想阻止通过maindomain.com/subdomain访问我的子域文件夹。

我想让它能够在可能的情况只能通过subdomain.maindomain.com打开

禁止访问,或只是重定向到其子域。

回答

2
RewriteEngine on 
RewriteBase/

#if not already blog.website.com 
RewriteCond %{HTTP_HOST} !^blog\.website\.com$ [NC] 
#if request is for blog/, go to blog.website.com 
RewriteRule ^blog/$ http://blog.website.com [L,NC,R=301] 
+0

我想在笨使用它。我试过但没有工作。 – Anupal

+0

Codeigniter有它自己的重写系统,你可能在那里发生冲突。 – Nutic

0

的htaccess:

RedirectMatch ^/subdomain/(.*)$ http://subdomain.mysite.com/$1 
相关问题