开发者

removing .php extension from .htaccess (404?)

I'm trying to removing .php extension from the url using .htaccess i've found a view sites that told me how to do this and i'm using;

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

However when i go to mydomain.com/user/settings (that would be mydomain.com/user/settings.php without the .htaccess)

It works fine. However when i go to mydomain.com/user/settings/ (trending splash on the end) it gives my开发者_开发知识库 custom 404 error page i've looked around on here (& Similar Questions) ask and google but can't really seem to work out what part i'm missing out?

Thank You, Flexer


Try this to handle the trailing slash

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^\.]+?)/?$ $1.php [NC,L] 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜