ISAPI 重写语法有帮助吗?
我有以下问题
RewriteMap mapfile txt:D:\mysite\urls.txt
RewriteRule ^([^?/]+)\.htm /vehicle.aspx?e=${mapfile:$1} [QSA]
RewriteRule ^(.*)\.htm $1\.aspx
现在我的问题是,我想让 /vehicles.aspx 页面的 url 看起来像这样(我正在从文件中读取)
/my-chevrolet-camaro.htm
哪个工作正常 - 我现在遇到的问题是如果有任何真实的浏览根目录中的页面时会抛出找不到页面?例如
default.htm
会抛出 404!我需要什么语法来检查列表然后照常进行?
I have the following
RewriteMap mapfile txt:D:\mysite\urls.txt
RewriteRule ^([^?/]+)\.htm /vehicle.aspx?e=${mapfile:$1} [QSA]
RewriteRule ^(.*)\.htm $1\.aspx
Now my problem is, I want to make the url's look like this for the /vehicles.aspx page (Which I am reading from a file)
/my-chevrolet-camaro.htm
Which is working fine - The problem I have now is if any of the REAL pages in the root are browsed to it throws a page not found?? For example
default.htm
Would throw a 404!! What syntax do I need to say check the list and then just carry on as normal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的最后一条规则,即,
将 *.htm 映射到 *.aspx。
这意味着default.htm 将被重写为default.aspx。如果您没有 default.aspx,则会抛出 404 错误。这有帮助吗?
Your last rule, i.e.,
maps *.htm to *.aspx.
This would mean that default.htm would be rewritten to default.aspx. If you don't have a default.aspx, then a 404 would be thrown. Does that help?