Mod 重写所有不是来自我的域和子域的流量
此时,我服务器上的每个站点都位于域“mydomain.com”或“subdomain.mydomain.com”上,我根据用于访问该站点的子域进行各种重写。
我现在想做的是将任何不是来自我的域或子域的请求发送到脚本进行处理......听起来很简单,但我无法让它工作......
这就是我所拥有的:
RewriteEngine on
RewriteCond %{ENV:Rewrite-Done} !^Yes$
RewriteCond %{HTTP_HOST} !^(.*)\.mydomain\.com
RewriteRule (.*) /_testing/htaccess/off.php?$1
它正确地让我的域或子域上的任何流量都会通过,但在重写时会出现 500 内部服务器错误。我错过了一些明显的东西吗?
At this time every site on my server is on the domain "mydomain.com" or "subdomain.mydomain.com", I do various re-writes depending on the subdomain used to access the site.
What I want to do now, is send any request NOT from my domain or subdomains to a script for handling...... sounds simple, but I can't get it working..
This is what I have:
RewriteEngine on
RewriteCond %{ENV:Rewrite-Done} !^Yes$
RewriteCond %{HTTP_HOST} !^(.*)\.mydomain\.com
RewriteRule (.*) /_testing/htaccess/off.php?$1
It correctly lets any traffic on my domain or subdomain through, but gives a 500 internal server error on the re-write. Am I missing something obvious?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个规则:
Try this rule:
事实证明,htaccess 规则无限期地重定向。这是因为我的处理程序脚本位于 /htaccess/ 目录本身内。
我已将处理程序文件移动到另一个位置,现在可以使用:
It turned out that the htaccess rule was redirecting indefinitely. This was because my handler script was inside the /htaccess/ directory itsself.
I've moved the handler file to another location and this now works: