.htaccess 复杂的访问问题

.htaccess 复杂的访问问题,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,假设我有以下文件结构: www.example.com/index.php(主页) www.example.com/about.php www.example.com/services.php www.example.com/contact.php 如何在.htaccess文件中使用mod_rewrite,以便在浏览器指向以下位置时: www.example.com/about.php 实际显示的URL为: www.example.com/about/ 但是,我不希望这适用于index.php

假设我有以下文件结构:

www.example.com/index.php(主页) www.example.com/about.php www.example.com/services.php www.example.com/contact.php

如何在.htaccess文件中使用mod_rewrite,以便在浏览器指向以下位置时: www.example.com/about.php

实际显示的URL为: www.example.com/about/

但是,我不希望这适用于index.php 换句话说,我不想看到: www.example.com/index/

感谢您的帮助,因为我要发疯了,想弄明白这一点D

RewriteCond %{REQUEST_FILENAME} !index.php$
RewriteRule ^(.*)\/$ $1.php [L]
编辑:我想这对复杂的人来说更好。说真的。我很喜欢,但为什么比赛开始时会出现
([0-9]+)-
?另外,
RewriteCond
是否也应该有一个锚来避免匹配
/about/index.php