【问题标题】:Prevent access to folder of subdomain on main domain阻止访问主域上的子域文件夹
【发布时间】:2012-11-18 19:57:27
【问题描述】:

我的主机上的网站很少。他们中的大多数都有自己的域。

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

我想让它只能通过 subdomain.maindomain.com 打开

如果可能,禁用访问,或者只是将其重定向到子域。

【问题讨论】:

    标签: web-services .htaccess cpanel


    【解决方案1】:

    htaccess:

    RedirectMatch ^/subdomain/(.*)$ http://subdomain.mysite.com/$1
    

    【讨论】:

      【解决方案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]
      

      【讨论】:

      • Codeigniter 有自己的重写系统,你可能有冲突。
      猜你喜欢
      • 2014-07-21
      • 2013-11-03
      • 2019-05-26
      • 1970-01-01
      • 2022-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多