Jump to content


Forcing SSL on All Web Traffic with htaccess

SSL htaccess web

  • Please log in to reply
No replies to this topic

#1 Joseph


    Advanced Member

  • Administrators
  • 46 posts
  • LocationPhilippines

Posted 05 August 2014 - 05:04 PM

Original Poster: ConnerT


Just a quick tutorial on setting up SSL and forcing it to your web server, this will be used in conjunction with an SSL Certificate.

This tutorial can be followed on all Operating Systems and with all web server, as long as they support the use of
system files of .htaccess.

Firstly it does help if you are familiar with the uses and regulation of a CLIE (Command Line Interface Editor)
these can be programs like Nano,Vim,Pico and others that you can easily acquire through APT or Yum.

Lets get started,

1) To start we will need to navigate to the folder where the root of your webserver is located,
for Apache this is usually in /var/www
2) if you have a file called ".htaccess" already in your DocumentRoot then skip to step 4)
3) create a file name ".htaccess" within your DocumentRoot of the web server
4) within this file at the top paste the following code:

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

5) Please change the https://www.yourdomain.com/ to the FQDN (Fully Qualified Domain Name) of
your server.
6) Save the file and restart the web server service from init.d

Also tagged with one or more of these keywords: SSL, htaccess, web

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users