重写映射不匹配
我的重写映射与事物不匹配时遇到问题:
RewriteMap map txt:rewritemaps\map.txt [NC]
RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND [NC]
RewriteRule ^(.+)$ ${map:$1} [NC, R=301]
该映射大约有 4,500 个条目,包括:
arctic /Destinations/Polar-Regions/The-Arctic.aspx
我的 RewriteLog,设置为级别 9,日志:
init rewrite engine with requested uri /arctic
Htaccess process request C:\Program Files\ISAPI Rewrite\httpd.conf
Htaccess process request C:\Websites\Path\WebSite\.htaccess
[..]
applying pattern '^(.+)$' to uri 'arctic'
map lookup FAILED: map=map[txt] key=arctic
RewriteCond: input='NOT_FOUND' pattern='NOT_FOUND' =>
它适用于不在映射中的页面 - 例如 /Contact-Us.aspx,但不适用于与应该匹配的东西(例如北极)。我尝试更改 [NC] 标志的位置,删除 RewriteCond 并重命名地图文件(以防“map”是保留关键字)。没有喜悦。这似乎也不是权限问题。
仅供参考,我使用的是 Helicontech 的 ISAPIRewrite,因为我使用的是 IIS6。
I'm having trouble with my rewritemap not matching things:
RewriteMap map txt:rewritemaps\map.txt [NC]
RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND [NC]
RewriteRule ^(.+)$ ${map:$1} [NC, R=301]
The map has about 4,500 entries, including:
arctic /Destinations/Polar-Regions/The-Arctic.aspx
My RewriteLog, set to level 9, logs:
init rewrite engine with requested uri /arctic
Htaccess process request C:\Program Files\ISAPI Rewrite\httpd.conf
Htaccess process request C:\Websites\Path\WebSite\.htaccess
[..]
applying pattern '^(.+)
It works with pages not in the map - eg /Contact-Us.aspx, but not with stuff which should match (such as arctic). I've tried changing location of the [NC] flag, removing the RewriteCond and renaming the map file (just in case 'map' was a reserved keyword). No joy. It also doesn't seem to be a permissions problem.
FYI, I'm using ISAPIRewrite by Helicontech as I'm on IIS6.
to uri 'arctic'
map lookup FAILED: map=map[txt] key=arctic
RewriteCond: input='NOT_FOUND' pattern='NOT_FOUND' =>
It works with pages not in the map - eg /Contact-Us.aspx, but not with stuff which should match (such as arctic). I've tried changing location of the [NC] flag, removing the RewriteCond and renaming the map file (just in case 'map' was a reserved keyword). No joy. It also doesn't seem to be a permissions problem.
FYI, I'm using ISAPIRewrite by Helicontech as I'm on IIS6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
三个建议:
Three suggestions:
如果map.txt与.htaccess位于同一文件夹中,请尝试以下定义:
如果位于其他位置,请尝试使用完全限定路径。
如果您还没有使用 ISAPI_Rewrite,请考虑更新到最新版本。
If map.txt is in the same folder with .htaccess, please try the following definition:
If it's in another location, please try to use fully-qualified path.
Also please consider updating to the latest build of ISAPI_Rewrite if you are not on it yet.
我遇到了同样的问题并用“”修复了它,尝试:
I had the same issue and fixed it with "", try: