.htaccess .php rewrite with / after


.htaccess .php rewrite with / after

所以我目前正在重写我的url和删除。php扩展使用以下:

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

如果我加载about。php页面,http://example.com/about它会显示我想要的东西,有没有办法让http://example.com/about/也显示about。php页面,以及所有类似的文件

如果在您的捕获正则表达式中存在尾斜杠,则可以删除它,如下所示:

RewriteRule ^([^'.|/]+)$ $1.php [NC,L]

这将把aboutabout/的请求都发送到about.php