Redirect HTTP to HTTPS with .htaccess file

  • January 20, 2024
  • 0 Comments

Redirect HTTP Port 80 Traffic to HTTPS Port 443 With A .htaccess File

OVERVIEW

Redirecting traffic refers to redirecting traffic from one port to another.
Like redirecting HTTP traffic to the Secure HTTPS port.

REQUIREMENTS

Before you start, be sure to have handy:

  • Your FTP login credentials and an FTP Client like FileZilla
  • SSH credentials or File Manager access
  • Text Editor

READ ME FIRST

As a configuration file, .htaccess is very powerful.
Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all.

Since .htaccess is a hidden system file, please make sure your FTP client is configured to show hidden files.
This is usually an option in the program's preferences/options.

This article is provided as a courtesy.

Installing, configuring, and troubleshooting third-party applications is outside the scope of basic support provided by Starburst Services.


INSTRUCTIONS

If you already have an .htaccess file simply add one of this snippet of code to your existing file, or create a new plain text document with this code and upload it to your public_html directory or a particular sub directory to localize the effect to just one of your sites or section of one of these sites:

Forward HTTP Traffic to HTTPS

To simply forward HTTP to HTTPS you can add the following to your .htaccess file.
Replace example.com on line 3 with your own domain name.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://excample.com[R,L]


RESOURCES

How do I redirect my site using a .htaccess file?

askapache.com


KB Article Created: 2024-01-10
KB Article Updated: 2024-01-20

How helpful was this article to you?

Posting has been disabled.