【问题标题】:How to solve Error code: ERR_TOO_MANY_REDIRECTS如何解决错误代码:ERR_TOO_MANY_REDIRECTS
【发布时间】:2013-09-10 13:06:03
【问题描述】:

当有人点击 url http://www.makememyvideo.com/dev/fr/project/9/1.php 时,我想将 http 重定向到 https,所以它应该是 https://www.makememyvideo.com/dev/fr/project/9/1.php

我正在使用这样的htaccess重定向方法,htaccess文件在文件夹9中

   Options -Multiviews
  <IfModule mod_rewrite.c>
   RewriteEngine On
   #RewriteBase  /fr/project/9

     RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.makememyvideo.com/dev/project/fr/9/$1 [R,L]

RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /fr/project/9/$1/ [L,R=301]

RewriteRule (.*)/$ /fr/project/9/$1.php [L]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .*[^/]$ /fr/project/9/$0/ [L,R=301]

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]

但它给出了重定向循环错误,我在文件夹项目和文档根目录中有 htaccess 文件。

任何帮助将不胜感激

谢谢

【问题讨论】:

    标签: php .htaccess redirect


    【解决方案1】:

    这在我的网站上运行

    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^ https://www.xxxxxx.com%{REQUEST_URI} [NC,L,R=301,NE]
    

    【讨论】:

      【解决方案2】:

      试试这些行:

      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule - https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
      

      【讨论】:

      • 嗨,这不是将 http 转换为 https,也没有给出任何错误
      猜你喜欢
      • 2014-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多