• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue https to http redirect

Robert A Williams

New Pleskian
Hiya,

Running Plesk 12.5.30 Update #40 and have a number of domains hosted.

I have had particular issues getting an SSL cert to work for this domain blog.starwheelastrology.com
I am running wordpress on it.

I have migrated a wordpress blog from wordpress.com to self-hosted and as the DNS transfers have taken place I cannot wait to sort the cert issue out and have instead decided to run the wordpress install as http for a while

Anyway I would like to redirect all https requests to http and I have tried adding a rewrite rule which works in part though it does not appear to redirect to the /httpdocs install location where wordpress is installed.

So i thought then the redirect might work to the home directory though this is not the case as I created a default index.html file in that location and it is not shown

I have used the rewrite rule as per:
https://www.siteground.com/kb/redirect-from-https-to-http/

Which I have added to .htaccess and also to the Apache Additional Directives page in plesk for that domain though it makes no differnece

Please see:
http://blog.starwheelastrology.com
VS
https://blog.starwheelastrology.com

ANY HELP appreciated

Thanks
 
Hi Robert A Williams
using ssllabs to test your site, I see you are using the self-signed Plesk one, I suggest you install the Lets Encrypt extension and create a real SSL Cert for free.
I hope that helps
Kind regards

Lloyd
 
Hi Robert A Williams,

if you consider to use NGINX as well ( which is a real performance boost in combination with PHP-FPM, when you use wordpress ), pls. have as well a look at the following example for HTACESS and ( possible ) nginx directives:

Default wordpress - HTACCESS ( pls. see as well: https://codex.wordpress.org/htaccess ), with the desire to redirect HTTPS to HTTP:
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Redirect HTTPS to HTTP
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


Recommended EXAMPLE - NGINX ( with PHP-FPM - usage on that subdomain! ) directives according to the above HTACCESS rules:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_pass "unix:/var/www/vhosts/system/blog.starwheelastrology.com/php-fpm.sock";
        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        include /etc/nginx/fastcgi.conf;
    }

   location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;
}

if ($http_x_forwarded_proto ~ "https"){
    set $rule_0 1;
}
if ($rule_0 = "1"){
    rewrite ^/(.*)$ http://$http_host{uri} permanent;
}


These HTACCESS rules and the ( possible ) nginx directives could be added at:

Home > Subscriptions > blog.starwheelastrology.com > Websites & Domains > Apache & nginx Settings



P.S.: Pls. consider as well to post your domain - specific configuration files, located at "/var/www/vhosts/system/blog.starwheelastrology.com/conf", if you experience issues/problems/failures. People willing to help you have then the possibility to investigate your issue. It is as well a good idea to post corresponding, domain - specific log - files entries ( log - file - location: "/var/www/vhosts/system/blog.starwheelastrology.com/logs" ) for further investigations.
 
You wish to run your Wordpress forum on http:// instead of https:// ?

In wp_config.php add the following lines:

define('WP_SITEURL', 'http://your.domain.com');
define('WP_HOME', 'http://your.domain.com');


This will still allow access over https but all links will redirect the visitor to the non-encrypted version of your site. It's the easiest solution yet. But honestly, if you have problems with your certificate, instead of dropping the encryption you should give the Let's Encrypt add-on of Plesk a try. It's fully automatic and doesn't cost a penny.

BTW: To do the opposite (e.g. enforcing https:// on everything) add the following to your vhost.conf:

Header always set Strict-Transport-Security "max-age=155520000"
 
Hi Robert A Williams
using ssllabs to test your site, I see you are using the self-signed Plesk one, I suggest you install the Lets Encrypt extension and create a real SSL Cert for free.
I hope that helps
Kind regards

Lloyd
Thanks Lloyd, not got the time to manage letsencrypt as the site is live and traffic was quite large so I have created SEO **** in the migration which I need to resolve ASAFP
 
Hi Robert A Williams,

if you consider to use NGINX as well ( which is a real performance boost in combination with PHP-FPM, when you use wordpress ), pls. have as well a look at the following example for HTACESS and ( possible ) nginx directives:

Default wordpress - HTACCESS ( pls. see as well: https://codex.wordpress.org/htaccess ), with the desire to redirect HTTPS to HTTP:
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Redirect HTTPS to HTTP
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

TRIED THE ABOVE AND IT DOES NOT WORK


Recommended EXAMPLE - NGINX ( with PHP-FPM - usage on that subdomain! ) directives according to the above HTACCESS rules:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_pass "unix:/var/www/vhosts/system/blog.starwheelastrology.com/php-fpm.sock";
        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        include /etc/nginx/fastcgi.conf;
    }

   location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;
}

if ($http_x_forwarded_proto ~ "https"){
    set $rule_0 1;
}
if ($rule_0 = "1"){
    rewrite ^/(.*)$ http://$http_host{uri} permanent;
}


These HTACCESS rules and the ( possible ) nginx directives could be added at:

Home > Subscriptions > blog.starwheelastrology.com > Websites & Domains > Apache & nginx Settings

TRIED THAT and STILL DOES NOT WORK

P.S.: Pls. consider as well to post your domain - specific configuration files, located at "/var/www/vhosts/system/blog.starwheelastrology.com/conf", if you experience issues/problems/failures. People willing to help you have then the possibility to investigate your issue. It is as well a good idea to post corresponding, domain - specific log - files entries ( log - file - location: "/var/www/vhosts/system/blog.starwheelastrology.com/logs" ) for further investigations.

Right thanks very much for all the info very helpful although I still cannot get the https redirect to work on the virtualhost and I have no idea why the server just serves the default parallels page when you go to https://blog.starwheelastrology.com

Also NGINX would be a good idea though I cannot afford any further down time or disruption on this domain as it will have a negative impact on SE ranking
 
You wish to run your Wordpress forum on http:// instead of https:// ?

In wp_config.php add the following lines:

define('WP_SITEURL', 'http://your.domain.com');
define('WP_HOME', 'http://your.domain.com');


This will still allow access over https but all links will redirect the visitor to the non-encrypted version of your site. It's the easiest solution yet. But honestly, if you have problems with your certificate, instead of dropping the encryption you should give the Let's Encrypt add-on of Plesk a try. It's fully automatic and doesn't cost a penny.

BTW: To do the opposite (e.g. enforcing https:// on everything) add the following to your vhost.conf:

Header always set Strict-Transport-Security "max-age=155520000"
Makes no odds I am afraid
 
Back
Top