我有一个 WordPress 博客,我想在其中添加一些自定义页面.php并从 url 中删除扩展名和查询字符串。
所有 WordPress 页面 url 都是这样的index.php?pagename=,所以如果我尝试RewriteRule ^(.*)$ $1.php在.htaccess文件中添加,其他页面返回500 internal server error. 如何从除index.phpand之外的所有内容中删除 php 扩展名login.php?
这是我现有的.htaccess文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# RewriteRule ^(.*)$ $1.php # add this line will broken the wordpress rewrite rule
</IfModule>
# END WordPress