mod_rewrite 新手需要帮助(简单?)重写规则
我试过。我失败了。这就是我想要做的:
使用 firebug,我看到样式表和其他内容的请求标头中的 GET 字符串被应用程序修改(我无法修改)。我认为一个简单的重写规则可能会有所帮助,但我无法让它发挥作用。这是我需要的:
输入:/content/2010/08/forum/styles/xyz/theme/normal.css
输出:/forum/styles/xyz/theme/normal.css< /strong>
输入:/content/forum/styles/xyz/template/blah.js
输出 /forum/styles/xyz/template/blah.js
输入: >/content/my-own-page/forum/happy.htm
输出:/forum/happy.htm
因此,无论出现什么,如果它包含“forum/”,那么就去掉“forum/”之前的内容并返回“forum/”中的所有内容。
I tried. I failed. Here's what I want to do:
Using firebug I saw that the GET string in the request header for my stylesheets and other content was being munged by the application (which I can't modify). I think a simple rewrite rule might help but I can't get it to work. Here's what I need:
input: /content/2010/08/forum/styles/xyz/theme/normal.css
output: /forum/styles/xyz/theme/normal.css
input: /content/forum/styles/xyz/template/blah.js
output /forum/styles/xyz/template/blah.js
input: /content/my-own-page/forum/happy.htm
output: /forum/happy.htm
So, whatever comes in IF it contains "forum/" then get rid of what precedes "forum/" and return everything from "forum/", foward.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
沿着这些思路的东西可能可以完成这项工作。
Something along these lines should probably do the job.