Redirect all traffic to root to include file in path mod_rewrite
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
精彩评论