Hernantz
Hernantz

Reputation: 566

.htaccess rewrite rule: i cant access folders, only php files

RewriteEngine On
RewriteRule ^([^\.]+)$ $1.php [QSA]

Well this is meant to remove the php extension and to find /login and match it with /login.php for example

It is working fine, but when i need to enter a folder /something it tries to match it with /something.php so i get a 404 error.

How can I make this rule to let me accesss folders too?

thanks in advance

Upvotes: 0

Views: 462

Answers (1)

Michael Irigoyen
Michael Irigoyen

Reputation: 22947

Try this:

RewriteRule ^login(/?|/.*)$ /login.php [QSA]

Upvotes: 1

Related Questions