web-services - 防止访问主域上子域的文件夹

标签 web-services .htaccess cpanel

我的主机上只有几个网站。他们中的大多数人都有自己的域名。

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

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

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

最佳答案

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]

关于web-services - 防止访问主域上子域的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13647890/

相关文章:

添加此 .htaccess 后,PHP 方法 ="post"停止工作...为什么?

c# - Web 服务拒绝接收参数并以 JSON 格式回复

php - 如何限制API访问受限域名?

web-services - REST 服务中的 session

email - 创建电子邮件帐户时出现 cPanel 错误。错误 : No specific error was returned with the failed API Call

其他人拥有的停放子域上的 SSL 证书?

http - 在没有 ssl 证书的情况下继续

WCF 服务最大方法数

regex - AngularJS 和 .htaccess 重定向

.htaccess - 需要通过使用.htaccess提供禁止的错误403来阻止Google bot,Bing bot和具有空用户代理的客户端