【问题标题】:when i redirect forcefully http to https it shows redirected you too many times当我将http强制重定向到https时,它显示重定向你太多次
【发布时间】:2017-07-04 20:30:14
【问题描述】:

我这样申请

<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 重定向您的次数过多。

【问题讨论】:

  • 意味着什么是确切的问题?意味着这段代码是否有效?
  • @bhavinthummar 实际上我不知道代码是否有效 RewriteRule ^Product/Category/([^/]*)$ /Product/index.php?category=$1 [L] RewriteRule ^ Pages/([^/]*)$ /Allpages/?Pages=$1 [L] RewriteRule ^Products/([^/]*)$ /Product/ProductPage.php?product=$1 [L] 在此代码正常工作之前

标签: .htaccess http


【解决方案1】:

好的@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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-21
    • 2020-05-28
    • 2016-07-06
    • 2020-07-23
    • 2016-11-14
    • 1970-01-01
    相关资源
    最近更新 更多