How to redirect HTTP to HTTPS in IBM HTTP Server or Apache HTTP Server

Redirect all traffic coming on port 80 to port 443.


Author(s): Tamas Bures | Created: 08 July 2019 | Last modified: 21 December 2024
Tested on: -

Redirect HTTP to HTTPS

  1. Open the <IHS/Apache install dir>/conf/httpd.conf file with a text editor.

  2. Enable the mod_rewrite.<so|dll> by uncommenting the line:

     #LoadModule rewrite_module modules/mod_rewrite.<so|dll>

    to

     LoadModule rewrite_module modules/mod_rewrite.<so|dll>
  3. Append the following configuration block to the end of the file.

     RewriteEngine on
     RewriteCond %{SERVER_PORT} =80
     RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]