使用htaccess删除https站点的php扩展


Remove php extension for https site using htaccess

我有以下内容要删除*.php扩展:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^'.]+)$ $1.php [NC,L]
RewriteCond %{REQUEST_URI} index'.php
RewriteRule ^(.*)index'.php$ $1 [R=301,L]

问题是,现在我已经安装了ssl证书,它不适用于子目录。

https://www.site.com WORKING(200)
https://www.site.com/example NOT WORKING (404)
https://www.site.com/example.php WORKING(200)

有人能帮我吗?

在尝试了几乎所有可能的解决方案后,我终于找到了解决方案。只需要将其添加到我的ssl站点的配置文件中:

<Directory path/to/your/site>
  AllowOverride FileInfo
</Directory>

更多信息请点击此处