将所有流量重定向到 root 以将文件包含在路径 mod_rewrite 中
我试图找出如何将所有请求重定向到:
http://www.i2systems.com
在 url 中包含“index.php”,如下所示:
http://www.i2systems.com/index.php
此请求:
http://www.i2systems.com/services/supply-chain-design/
变为:
http://www.i2systems.com/index.php/services/supply-chain-design/
我怎样才能实现此目的 - 我已经尝试过这个,但它不起作用:
RewriteCond %{HTTP_HOST} ^i2systems.com [NC]<br>
RewriteRule ^(.*)$ http://www.i2systems.com/$1 [L,R=301]<br>
RewriteRule ^$ index.php [L]
I'm trying to figure out how to redirect all requests to:
http://www.i2systems.com
To include "index.php" in url like this:
http://www.i2systems.com/index.php
This request:
http://www.i2systems.com/services/supply-chain-design/
becomes this:
http://www.i2systems.com/index.php/services/supply-chain-design/
How can I achieve this - I have tried this, but its not working:
RewriteCond %{HTTP_HOST} ^i2systems.com [NC]<br>
RewriteRule ^(.*)$ http://www.i2systems.com/$1 [L,R=301]<br>
RewriteRule ^$ index.php [L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议这样:
因为当index.php已经存在于请求URI的开头时,不要重定向是很重要的。
更新:为了避免 css、js 重定向,请尝试以下操作(假设您只想按照原始问题重定向 /services/ 路径):
I would suggest something like this:
Since it is important to NOT to redirect when index.php is already present at the start of request URI.
Update: To avoid css, js redirection try this (assuming you only want /services/ path to redirect as per your original question):