当我强行重定向HTTP到HTTPS时,它显示重定向了太多次



我是这样申请的

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^Product/Category/([^/]*)$ /Product/index.php?category=$1 [L]
RewriteRule ^Pages/([^/]*)$ /Allpages/?Pages=$1 [L]
RewriteRule ^Products/([^/]*)$ /Product/ProductPage.php?product=$1 [L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

但是,它显示 www.example.com 重定向了您太多次。

好的@ravi我遇到了你的问题,所以请使用这个解决方案。

新代码 :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^Product/Category/([^/]*)$ /Product/index.php?category=$1 [L]
RewriteRule ^Pages/([^/]*)$ /Allpages/?Pages=$1 [L]
RewriteRule ^Products/([^/]*)$ /Product/ProductPage.php?product=$1 [L]

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}
</IfModule>

最新更新