Redirect directory to file .htaccess

GGG

I'm trying to make a system so this this url:

example.com/php/get

gets redirected to something like this:

example.com/get.php

All of this with .htaccess

I have this:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/php/$
RewriteRule ^(.+)$ /$1.php [L,QSA]

But it doens't seems to work...

Rahil Wazir

Try this:

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related