How to Force http to https in AWS WordPress Package by Litespeed?

sibipaul

Well-Known Member
#1
Hello,

I am New Here...

So, Kindly Read this Post and Try to Answer me...

I'm New to Litespeed & Openlitespeed ( not even know the difference between ) :)

Installed WordPress Package through Amazon AWS EC2 - https://aws.amazon.com/marketplace/pp/B07KSC2QQN

After Configured EC2 Instance, I Logged into Putty SSH and Connected my Domain to the Litespeed Installation

by selecting Commands YES/NO

as mentioned in this Page - https://docs.litespeedtech.com/cloud/wordpress/

BUT, I have selected NO when The Command asked for Let's Encrypt SSL.

Because I wanted to use Amazon's SSL ( Which is Good to Use with AWS CDN )

NB: If I use Let's Encrypt SSL, by selecting YES in the Putty Command, Then I have to Upload Custom SSL certificate to AWS and Renew it every 3 Months.

to Avoid that Hassle, I choose NO.

everything else, in Putty, is done... finally, it asked me to Upgrade server, and That Also Done.

After that...

I Logged into AWS and Created an SSL.

Changed WordPress Address (URL) & Site Address (URL) at the WordPress Backend.

Now, My website https://www.flowerwase.com is Opening and Working With SSL - Kindly Check Your self.

Internal Links also Changed HTTP to HTTPS, Due to the WordPress Address Change.

So,

What is My Problem?

Visit http://www.flowerwase.com Now, Site Opening without HTTPS.

I wanted to Fix This.

I want to Redirect HTTP to HTTPS

if I Followed the Command in Putty ( for SSL ) and Choose the Let's Encrypt. There is an Option to Force HTTP to HTTPS

as per this URL https://docs.litespeedtech.com/cloud/wordpress/

But, I did not choose Let's Encrypt and My SSL is Installed by AWS.

So,

What do I want to do now?

Very Simple, Help me with Some commands,

That will redirect or force HTTP to HTTPS

Commands work with putty will be good.

ex: the command which RUNs when we select Let's Encrypt.

NB: Some people may come with htaccess rewrite codes.

but... I'm maybe not happy with that.

if no other solution, maybe I will use htaccess.


For Whom This Solution Will be GOOD For...?

For All People, using AWS + Litespeed WP Package + Custom SSL ( Other than Let's Encrypt )

I Couldn't find a tutorial anywhere online.

My last hope is this Official Forum.

let's see how you deal with this... :)
 

Unique_Eric

Administrator
Staff member
#2
HI,

How about adding these rules to LSWS web admin (port 7080) -> Virtual Hosts -> wordpress -> Rewrite Tab -> Edit Rewrite Rules.

Code:
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
or

Code:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
Let us know if it works.

Best
 

sibipaul

Well-Known Member
#5
I visited https://my-server-ip:7080/login.php

also tested https://my-server-ip:7080

But Page not opens in the browser...

When I checked the URL https://docs.litespeedtech.com/cloud/wordpress/#web-server-control-panel-access

I came to understand, I need to Allo all IP to access port 7080.

So, I run a Command on Putty

Code:
ufw allow 7080
But, I received a error , says...

ERROR: You need to be root to run this script

how to solve this?
 
Last edited by a moderator:

sibipaul

Well-Known Member
#11
the welcome message shows " ubuntu" but it is not the user name.

" admin " worked and logged in,

finally, I have set up SSL Force HTTPS.

Now, I request you to visit the HTTP Version of my domain.

That loads to HTTPS.

Happy :)


I need one more help from you,

That is, https://my-server-ip/phpmyadmin
How to get user ID and password to login with php my admin?

I need the user name and password as text format, not the encrypted.
 
Last edited by a moderator:
Top