允许一个URL,以避免在.htaccess一个mod_rewrite的规则 [英] Allow a url to avoid a mod_rewrite rule in .htaccess

查看:115
本文介绍了允许一个URL,以避免在.htaccess一个mod_rewrite的规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在除了通过我的域名访问Web,我的ISP可以访问我的网站thruogh的格式如下: user.hostname.com ,其中用户是我的登录名和主机名是我的ISP。我已经写了重写规则来自动重新映射 user.hostname.com www.mydomain.com ,这个效果很好。事实证明,但是我查看我的网站的统计资料,我的ISP要求我访问 user.hostname.com/stats/index.html 。有了我重写规则,这被更改为 www.mydomain.com/stats/index.html ,我无法访问统计页面。

In addition to web access through my domain names, my ISP allows access to my website thruogh the following format: user.hostname.com, where user is my login name and hostname is my ISP. I have written rewrite rules to automatically remap user.hostname.com to www.mydomain.com, and this works well. It turns out however for me to view the stats on my site, my ISP requires me to access user.hostname.com/stats/index.html. With my rewrite rules in place, this gets changed to www.mydomain.com/stats/index.html and I cannot access the stats page.

有没有一种方法,你能想到的,让 user.hostname.com/stats 通过不变,同时还改写所有其他用户。 hostname.com 要求?

Is there a way you can think of to allow user.hostname.com/stats to pass through unchanged while still rewriting all other user.hostname.com requests?

感谢。

推荐答案

如果使用Apache 2.2试试这个+:

Try this if using Apache 2.2+:

RewriteRule ^/stats(|/.*)$ - [last]
# After that the other rewrites...

在此之前的Apache 2.2,mod_rewrite的似乎不支持 - (破折号)的替代模式。在这种情况下,使用以下规则:

Prior to Apache 2.2, mod_rewrite doesn't seem to support '-' (dash) in the substitution pattern. In that case, use the following rule:

RewriteRule ^/stats(|/.*)$ /stats$1 [last]

这篇关于允许一个URL,以避免在.htaccess一个mod_rewrite的规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆