开发者

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

开发者 https://www.devze.com 2023-02-02 11:50 出处:网络
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
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 t开发者_运维百科o 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


Try this:

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

精彩评论

暂无评论...
验证码 换一张
取 消