当我已经有重定向时,如何添加代码从.htaccess文件中删除.php


How do I add code to remove the .php from the .htaccess file when I already have a redirect?

我已经有代码添加https。。。那么我该如何从url的末尾删除.php呢?这就是我的代码到目前为止的样子。

RewriteEngine On
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

我还想把www添加到url的前面。。。例如https://www.google.com

您可以像这样删除.php:

RewriteRule ^index    index.php

然后您需要调用www.example.com/index而不是www.example.com/index.php