How to force redirect HTTP to HTTPS website in CyberPanel?

In this article we will tell you how to force redirect HTTP to HTTPS website in CyberPanel?

What is HTTP?

HTTP stand foe Hypertext Transport Protocol. When you enter http:// in your address bar in front of domain, it tells the browser to connect over HTTP. HTTP use TCP(Transmission control protocol), generally over port 80, to send and receive data packets over ther web.

What is HTTPS?

HTTPS stands for Hypertext Transfer Protocol Secure (also referred to as HTTP over TLS or HTTP over SSL). When you enter https://in your address bar in front of the domain, it tells the browser to connect over HTTPS. Generally sites running over HTTPS will have a redirect in place so even if you type in http:// it will redirect to deliver over a secured connection. HTTPS also uses TCP (Transmission Control Protocol) to send and receive data packets, but it does so over port 443, within a connection encrypted by Transport Layer Security (TLS).

Redirect from HTTP to HTTPS

if you forcefully redirect your website HTTP to HTTPS in Cyberpanel, you will need to add a rewrite rule to that website in order to have it automatically forward to HTTPS instead of HTTP.

In CyberPanel you can forcefully redirect HTTP to HTTPS website using rewrite rules.

To add this:

Force redirect HTTP to HTTPS website in CyberPanel:

  1. Select Websites on the left menu
force redirect HTTP to HTTPS website in CyberPanel

2. Choose the SSL enabled website from the list

force redirect HTTP to HTTPS website in CyberPanel

3. Select “Rewrite Rules” in the Configuration section

force redirect HTTP to HTTPS website in CyberPanel

4. Copy and paste the following code:

force redirect HTTP to HTTPS website in CyberPanel
rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

5. Now just save your changes, and you’re done!

After doing this on OpenLiteSpeed you must have to restart your webserver. Beacuse OLS need to restart to read the rewrite rules properly.

How to add ZeroSSL on your site? Free SSL for your website?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

Access Cyberpanel Via Hostname with SSL- Issue SSL for Hostname

DO you want to access CyberPanel via a hostname with valid SSL ?

By default, you can access your cyber panel using the IP of your server and Port 8090. But For a valid SSL certificate, you must need a valid domain to access cyber panel with a valid SSL.

In this article, we will discuss how you can select a hostname and then issue SSL for that. So follow all steps along to access Cyberpanel Via Hostname with SSL.

Table of Content:

  1. Select a Valid Domain
  2. Create a Website on CyberPanel
  3. Issue SSL for HostName
  4. Access Cyberpanel

Select a Valid Domain

To access CyberPanel through a hostname and valid SSL first you need a domain through which you want to access CyberPanel. Like you want to use https://domian.com:8090 to access your CyberPanel you need to add domain.com to your CyberPanel.

Before creating a domain make sure that your DNS A records are point this server where you want to add a domain.

Create a Website on CyberPanel

To do so login to your CyberPanel using your Credentials then go to Websites->Create Website :

Create a Website on CyberPanel

Now provide all the required details and press Create Website button.

Now provide all the required details and press Create Website button.

Now your required website is created. SSL may be working for this domain But we need to issue for the Hostname and select this domain as the hostname.

Issue SSL for HostName:

Go to the SLL->Hostname SSL

Issue SSL for HostName:

Now select that domain you want to use for the Hostname. Then Press the Issue SSL.

Now select that domain you want to use for the Hostname. Then Press the Issue SSL.

This domain has now SSL for hostname you can use this to access cyberpanel

Access Cyberpanel:

Now it’s time to check that is this domain is working to access the CyberPanel. Go to your brewers and visit the Link https://your-domain.com:8090 it should work for your Hostname now you can access CyberPanel using this link.

Read More: How to set up Google Drive Backup on CyberPanel?