htaccess重写规则url
我想编写 htaccess 规则,在那里我可以重写它,
www.example.com/Project_Name/1/23 project.html?n=$1&p=$2&i=$3
我已经有了这个,但问题是我在 /projects/projects.xml 中有一个文件,当我用 Ajax 调用它时,它也会被重写。
RewriteRule ^([\._\-a-zA-Z0-9]*)\/([0-9]*)\/([0-9]*)(.?)$ /project.html?n=$1&p=$2&i=$3 [NC]
I want to write htaccess rules where I can rewrite this
www.example.com/Project_Name/1/23 project.html?n=$1&p=$2&i=$3
I have this already, but the problem is that I have a file in /projects/projects.xml which gets rewritten as well when I call it with Ajax.
RewriteRule ^([\._\-a-zA-Z0-9]*)\/([0-9]*)\/([0-9]*)(.?)$ /project.html?n=$1&p=$2&i=$3 [NC]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 RewriteRule 上方添加
RewriteCond %{REQUEST_FILENAME} !-f
。假设projects.xml 是一个实际文件,应该可以防止重写。Try adding
RewriteCond %{REQUEST_FILENAME} !-f
above the RewriteRule. Assuming projects.xml is an actual file, that should prevent rewriting.