newman
newman

Reputation: 424

Issue with .htaccess rewrite

I have several servers that have different catalytic structure with the same files. I want to redirect all addresses that have at least 1 phrase ".php/" for example: http://localhost/kat1/kat2/kat3/index.php/abc to http://localhost/kat1/kat2/kat3/index.php. and http://localhost/kat1/kat2/kat3/kat4/index.php/abc/index.php to http://localhost/kat1/kat2/kat3/index.php.

I try that but it does not work:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*).php\/(.*)$ index.php 

How can i do that?

Upvotes: 1

Views: 19

Answers (1)

anubhava
anubhava

Reputation: 785886

You can use this single rule in your site root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(.+?\.php)/ [NC]
RewriteRule ^ /%1 [L,NE,R=301]

# remaining rules go below

Upvotes: 1

Related Questions