how to make several redirection

Posted by Olesya Manevich on Stack Overflow See other posts from Stack Overflow or by Olesya Manevich
Published on 2012-10-12T03:32:01Z Indexed on 2012/10/12 3:37 UTC
Read the original article Hit count: 97

Filed under:
|
|

Right now I am updating my web site and I want to change all links to non-extension links like example.com/test.php to example.com/test. THis solution I found I put in .htaccess file:

 RewriteCond %{THE_REQUEST} ^GET\ /(([^/?]*/)*[^/?]+)\.php
RewriteRule ^.+\.php$ /%1 [L,R=301]

But at the same time I need to make redirection for links what located in lower level of my web-site like example.com/level/test2.php to example.com/test2.php. What should I write in .htaccess to redirect my files from lower level to higher and remove .php extension at the same time?

p.s. Thank you very much! and sorry for my poor English.

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about redirect