开发者

Redirect all traffic to root to include file in path mod_rewrite

开发者 https://www.devze.com 2023-02-17 06:19 出处:网络
I\'m trying to figure out how to redirect all requests to: http://www.i2systems.com To include \"index.php\" in url like this:

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 thi开发者_开发技巧s - 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]


I would suggest something like this:

RewriteEngine On    
RewriteCond %{REQUEST_URI} !^/index.php/.*
RewriteRule (.+) /index.php/$1 [R=301,L]

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):

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/services/.*
RewriteRule (.*) /index.php/$1 [R=301,L]


RewriteEngine On

RewriteCond %{query_string} ^(.*)
RewriteRule (.*) index.php/$1?%1
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号