Installation Guide: System Requirements for Ubuntu
Before installing Ubuntu, it’s essential to understand the system requirements for the version you want.…
You can follow any of the three methods mentioned below for redirecting your website from HTTP to HTTPS-
Method 1: Using a .htaccess file
You can use the following code and edit the .htaccessfile for moving from HTTP to HTTPS-
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Usually, the websites often use an HTTP protocol as the default protocol for handling all the critical information. Still, with https, you get various security and other benefits for your website.
Method 2: Using a PHP function
You can also use the following .php function for redirecting your website. You just need to call the function in the right place from where you wish to get the redirection.
< ?php
function redirectTohttps() {
if($_SERVER[‘HTTPS’]!=”on”) {
$redirect= “https://”.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’];
header(“Location:$redirect”); } }
?>
Method 3: Using an HTML Meta Tag
The methods discussed above are sufficient enough for making a move to HTTP from HTTPS. Using an HTML Tag might not be that effective as compared to the previous two. Still, you can use it if you fail to use the “mod rewrite.”
Make sure to add the following to your web page header-
< meta http-equiv=”Refresh” content=”0;URL=https://www.yourdomainname.com” />
Explore more hosting insights, tips and industry updates.
Before installing Ubuntu, it’s essential to understand the system requirements for the version you want.…
What is PHP? PHP is a popular open-source script language that incorporated into HTML and…
Binding multiple IP addresses to a server allows you to host multiple websites, applications, or…