Can't seem to get redirect from https to http working in conf file

41 views Asked by At

Please take a look at my .conf file. I am trying to redirect people visiting my site on https to http as I need to sort some other stuff before I can renew the SSL cert so for the time being need to redirect all visitors to http://

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com

    DocumentRoot /var/www/myproject
</VirtualHost>

<VirtualHost *:443>
    ServerName www.example.com
    ServerAlias example.com

    // method 1 - Not working
    RedirectMatch permanent ^(.*)$ http://www.example.com$1

    // method 2  - Not working
    Redirect / http://www.example.com/

    // method 3 - Not working
    RewriteEngine On
    RewriteCond %{HTTPS} On
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

    // method 4 - Not working
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 443
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1

    DocumentRoot /var/www/myproject
</VirtualHost>
0

There are 0 answers