当我已经有了重定向时,如何添加代码从.htaccess文件中删除.php?
我已经有了添加https的代码。。。那么,如何从url末尾删除.php呢?到目前为止,我的代码就是这样的当我已经有了重定向时,如何添加代码从.htaccess文件中删除.php?,php,.htaccess,Php,.htaccess,我已经有了添加https的代码。。。那么,如何从url末尾删除.php呢?到目前为止,我的代码就是这样的 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 我还想在url前面添加www。。。e、 g.https://www.google.com您可以像这样删除.php: RewriteRule ^index index.p
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
我还想在url前面添加
www
。。。e、 g.https://www.google.com
您可以像这样删除.php:
RewriteRule ^index index.php
然后你需要调用
www.example.com/index
,而不是www.example.com/index.php
听起来像是一个dupeUse Nginx,远比(我猜)Apache高级。此外,Nginx速度更快,可靠性更高。至少在我看来。