【发布时间】:2017-04-14 17:05:34
【问题描述】:
现在我有一个 https。我需要在.htaccess 中进行重定向。我可以找到这个:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
但我发现如果用户写:
http://myDomain/someFile
它重定向到:
https://myDomain/someFile.php
我想正确的应该是没有 .php 该怎么做?
这些都是规则:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
【问题讨论】: