0

I just migrate my WordPress website to google cloud using openlitespeed server. After setting up SSL my website is not redirecting to HTTPS although I set https redirect on my .httaccess. Also when a user point HTTP:// this code show up instead of my homepage.

<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/

/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';

but it works fine when someone point HTTPS://

my .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

In WordPress setting it's HTTPS:// before url

I tried every possible fix found on google none of them worked for me.

altrgeek
  • 1
  • 1
  • Will it work if you move RewriteCond %{HTTPS} off and RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] rules to the top of .htaccess and run service lsws restart command? – Eric May 10 '20 at 02:05
  • The problem is in your server configuration you haven't shared. Also, you should not be doing the redirect from HTTP to HTTPS using `.htaccess` as you could do it directly through the server configuration. – Esa Jokinen May 10 '20 at 06:10
  • 1
    Finally I fixed it, http port 80 was not listening by openlitespeed because it was running by apache2, so I had to remove apache2 and run service lsws restart – altrgeek May 10 '20 at 07:24

0 Answers0