Tag Archives: Redirecting HTTP

How To Redirect HTTP URLs to HTTPS Via .htaccesss File?

After the SSL is installed on your domain name, you will need to redirect all non-secure HTTP links to their secure HTTPS connection for several important reasons.

For any website to work over SSL, there are some modifications you will need to make to your .htaccess file, and then it will redirect your visitors to the HTTPS version of your website. To start with the process of HTTP redirection simply login to your Sangkrit.net account and follow these steps:

  1. Go to your product page.
  2. Under the Server, click Manage for cPanel
  3. In the Account Dashboard, click File Manager.
  4. In the cPanel File Manager, click Settings.
  5. Make sure that Show Hidden Files (dotfiles) is checked, and click Save.
  6. Click on public_html, and open your .htaccess if you already have one. If not, click File+, name the file .htaccess and click Create New File.
  7. Select the .htaccess file, and click Edit.
    • If you just created your .htaccess file, use this code:
      RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
    • If your .htaccess file already exists, insert the lines that begin with ReWriteCond and RewriteRule directly after the already existing ReWriteEngine On.
    • Click Save Changes and Close. 

That’s it. Visit your website and you’ll be re-directed to the HTTPS version.

How To Redirect HTTP To HTTPS In WordPress?

  1. Log into your WordPress Dashboard.
  2. Visit Settings, click General.
  3. Locate the following fields:
    • WordPress Address (URL)
    • Site Address (URL)
  4. In each field, update your URLs from http to https
  5. Scroll down and click Save Changes.
  6. Open your current .htaccess file in the /public_html/ folder with the cPanel file manager for editing. If you don’t already have a .htaccess file, you’ll need to create one.
  7. Insert the following code at the top of your .htaccess file:
  8. Click Save Changes at the top-right corner of the screen.

In some cases, you will need to edit your .htaccess file, if you don’t want that then use a WordPress plugin like Really Simple SSL. This saves you from the technical steps edit file editing on the server.

The Importance Of Redirecting HTTP To HTTPS After Installing SSL

Redirecting HTTP to HTTPS after installing an SSL Certificate is important as both HTTP and HTTPS versions start to work simultaneously on your website and most of your traffic continues to land on the old HTTP version. It is crucial for several other reasons as well –

  1. Website Security: HTTPS encrypts data transmitted between the user’s browser and your website, making it secure and protecting sensitive information such as login credentials, payment details, and personal data. If your website is accessible via HTTP, users’ data may be vulnerable to interception and tampering.
  2. User Experience: Search engines like Google prioritize HTTPS websites in their search rankings. This means that redirecting to HTTPS can improve your website’s visibility and attract more organic traffic. Additionally, users are becoming increasingly aware of the importance of online security and are more likely to trust and interact with websites that use HTTPS.
  3. Compliance: Many industries and regulatory bodies require websites to use HTTPS to protect sensitive data. By redirecting HTTP to HTTPS, you ensure that your website complies with these regulations.
  4. Mixed Content Issues: When a webpage loads content over both HTTP and HTTPS, it can cause security issues and disrupt the user experience. Redirecting to HTTPS ensures that all content is loaded securely.

Methods Of Redirecting HTTP to HTTPS

There are several ways to redirect HTTP to HTTPS, including:

  • Using server configuration: Most web servers (like Apache and Nginx) allow you to configure redirects using their built-in features. This method contains some very technical steps.
  • Using a .htaccess file: If you’re using Apache, you can create a .htaccess file in your website’s root directory and add a redirect rule. This method is easier in comparison to the above method.
  • Using a plugin or tool: Many content management systems (CMS) and web hosting providers offer plugins or tools that can automatically redirect HTTP traffic to HTTPS. This is the easiest one, WordPress users can simply use the ‘Really Simple SSL’ plugin.

Redirecting HTTP to HTTPS is essential for ensuring the security, user experience, compliance, and overall success of your website. The next lesson will guide you through the complete process of redirecting the HTTP version of your website to the secure HTTPS version.