mod_rewrite重定向问题
我已经查看了相关问题,但没有运气。
我正在尝试重写这样的内容: http://www.example.com/v2/index.php/en/company/careers/training-and-implementation-specialist/
到此:http://www.example.com/en/company/careers/training-and-implementation-specialist/< /a>
让事情变得更混乱的是,上面 URL 中的“index.php”是一个文件,而不是一个目录。我试图制定一个规则,将 www.example.com/v2/index.php/(anything) 变成 www.example.com/(anything)
我感觉这应该很容易,我尝试了这个: RewriteRule ^v2/index.php/(.*) /$1 [L]
但没有运气 - 对于我在 /v2/index.php 中尝试的任何内容,它都会得到 404。 php。
有什么建议吗?
I've looked through the related questions, but no luck.
I'm trying to rewrite something like this: http://www.example.com/v2/index.php/en/company/careers/training-and-implementation-specialist/
to this: http://www.example.com/en/company/careers/training-and-implementation-specialist/
To make things a little more confusing, The "index.php" in the URL above is a file, not a directory. I'm trying to make a rule where www.example.com/v2/index.php/(anything) turns into www.example.com/(anything)
I feel like this should be easy, and I tried this: RewriteRule ^v2/index.php/(.*) /$1 [L]
but no luck -- it gets 404'd for anything I try that's in /v2/index.php.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解你想做什么,我相信你已经搞反了。试试这个:
If I'm understanding what you want to do, I believe you have it backwards. Try this:
问题出在
RewriteRule ^v2/index.php/(.*) /$1 [L]
中索引和 php 之间的.
来重写 try-
RewriteRule ^ v2/index\.php/(.*)$ /$1 [L]
如果要重定向,请将
[L]
更改为[R,L]
>The problem is with
.
between index and php inRewriteRule ^v2/index.php/(.*) /$1 [L]
To rewrite try-
RewriteRule ^v2/index\.php/(.*)$ /$1 [L]
if you want to redirect, change
[L]
to[R,L]