【问题标题】:Redirecting https to http ISPConfig & Apache将 https 重定向到 http ISPConfig 和 Apache
【发布时间】:2013-05-04 00:08:07
【问题描述】:

前段时间,我设法用 Apache 将我的所有 https 重定向到 http(而不是相反)。 我想这样做是因为我没有任何 SSL 证书,但我使用的所有浏览器都强制使用 https,因此导致 SSL 错误或超时,具体取决于我是否监听 443 端口。 但是因为我很笨,我忘记保存包含该解决方案的 Apache 的 vhost 文件,我无法让它再次工作。

我在互联网上尝试了所有方法,但没有任何效果。

如果这有什么改变,我将 ISPConfig 与 Apache 一起使用。

我尝试将重写规则放在 .htacess 中,但没有任何反应。 在 apache 的 default-ssl.vhost 中尝试了这些相同的规则,但没有再次发生。

这让我发疯。 这是我尝试过的规则,似乎对除我以外的所有人都有效。

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

我可能没有把它放在正确的位置,因为我对 Apache 和服务器配置了解不多,但是因为我试图把它放在任何地方,如果我错过了位置,我会被诅咒的。

谁能告诉我这些规则应该放在哪里,或者在我哭之前帮我找到重定向问题的解决方案?

【问题讨论】:

    标签: apache zend-framework debian


    【解决方案1】:

    在那个愚蠢的问题上浪费了我一夜之后,我终于发现既然 Zend 将 boostrap 和 access 文件放在了 root/public 目录中,我只需要添加

    <Directory "/var/www/<link to site made by ISPConfig>/web/public">
                AllowOverride All
                Order allow,deny
                Allow from all
                RewriteEngine On
                RewriteCond %{HTTPS} on
                RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
        </Directory>
        <Directory "/var/www/clients/client0/web1/web/public">
                AllowOverride All
                Order allow,deny
                Allow from all
                RewriteEngine On
                RewriteCond %{HTTPS} on
                RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
        </Directory>
    

    代替

    <Directory "/var/www/<link to site made by ISPConfig>/web">
                AllowOverride All
                Order allow,deny
                Allow from all
                RewriteEngine On
                RewriteCond %{HTTPS} on
                RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
        </Directory>
        <Directory "/var/www/clients/client0/web1/web">
                AllowOverride All
                Order allow,deny
                Allow from all
                RewriteEngine On
                RewriteCond %{HTTPS} on
                RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
        </Directory>
    

    这只是一个该死的目录故事

    我希望当我再次忘记时它会以某种方式帮助某人或至少帮助我自己。

    【讨论】:

      猜你喜欢
      • 2014-11-24
      • 2015-08-16
      • 2019-11-08
      • 2019-12-17
      • 2017-02-02
      • 2013-09-27
      • 2016-02-04
      • 2021-03-02
      • 1970-01-01
      相关资源
      最近更新 更多