Redirecting https to http ISPConfig & Apache

2019-09-05 03:50发布

some time ago I managed to find a way to redirect all my https to http (and not the opposite) with Apache. I wanted to do that because I don't have any SSL certificate but all the browser I use force https, therefore leading to SSL error, or timeout depending on if I listen to the 443's port or not. But because I'm stupid, I forgot to save the vhost files for Apache containing that solution and I can't make it work again.

I tried everything on the internet but nothing worked.

If that changes anything, I use ISPConfig with Apache.

I tried putting rewrite rules in the .htacess and nothing happened. Tried these same rules in the default-ssl.vhost of apache and nothing happened again.

It's driving me mad. This is the rules I tried and seems to work for everyone but me.

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

I may not be putting this at the right place, since I don't know a lot about Apache and server configuration, but since I tried to put it everywhere I'll be damn if I missed the spot.

Can someone please indicate me where to put these rules, or help me find a solution for my redirection problem before I cry ?

1条回答
祖国的老花朵
2楼-- · 2019-09-05 04:01

After wasting my whole night on that idotic problem, I finally found out that since Zend put the boostrap and access files in the root/public directory, I just had to add

<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>

Instead of

<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>

It was just a damn story of Directories

I hope that it will somehow help someone or at least help myself when I'll forget again.

查看更多
登录 后发表回答