如何从一个子目录重定向到另一个目录,但使用 mod_rewrite 从 URI 中删除原始子目录
我有一个在 12001 上运行的 Ruby on Rails 应用程序。我当前正在使用一些 ReWriteCond 检测将子域重定向到 127.0.0.1:12001。 现在我想将我的子目录重定向到该 Rails 应用程序。
http[s]://domain.com/redmine
当前
127.0.0.1:12001
规则将 REQUEST_URI 应用于上述 Rails 路径,但我需要从 REQUEST_URI 前面删除“/redmine”...
有什么想法吗?
I have a Ruby on Rails app running on 12001. I am currently redirecting a subdomain to 127.0.0.1:12001 using some ReWriteCond detection.
Now I want to redirect my subdirectory to that rails app.
http[s]://domain.com/redmine
to
127.0.0.1:12001
The current rules apply REQUEST_URI to the above rails path, but I need to strip "/redmine" from the front of REQUEST_URI...
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在不使用 mod_rewrite 的情况下执行此操作。
这应该做你想做的。
You can do this without mod_rewrite.
This should do what you want.
如果规则放置在 Directory 指令中,则:
末尾的参数:
NB /redmine 将不会与此规则匹配,但我将放弃您尝试过的内容,仅使用子路径,例如 /redmine/abc
If the rule is placed in the Directory directive, then:
The parameters at the end:
NB /redmine will not be matched by this rule, but I am going off what you tried, only subpaths, e.g. /redmine/abc