To secure your entire site:

  1.  Open the .htaccess file in your site’s document root.
  2.  Add the following:

RewriteEngine On
# This will enable the Rewrite capabilities

RewriteCond %{SERVER_PORT} 80
# This checks to make sure the connection is not already HTTPS – port 80 indicates a non-secured HTTP connection.

RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
# This rule will redirect users from their original location to the same location but be using HTTPS.
# Example: Visitors trying to access http://www.domain.com/somesubsection/ will be redirected to https://www.domain.com/somesubsection/

Remember to change the URL in the example above to the actual URL you wish to protect.

To secure a specific directory on your site:

The below solution should be applied in a .htaccess file in the directory to be secured. (If no .htaccess file exists, you can create a new one. Note that any .htaccess file in a directory tree operates on all subdirectories, and rules in a higher level .htaccess file will be applied unless overridden by rules in a lower level .htaccess file. )

  1. Open or create the .htaccess file.
  2. Add the following: RewriteEngine On
    # This will enable the Rewrite capabilitiesRewriteCond %{SERVER_PORT} 80
    # This checks to make sure the connection is not already HTTPS – port 80 indicates a non-secured HTTP connection.RewriteRule ^(.*)$ https://www.domain.com/somesubsection/$1 [R=301,L]
    # This rule will redirect users from their original location in /some subsection/ to the same location but using HTTPS.
    # Example: Visitors trying to access http://www.domain.com/somesubsection/ will be redirected to https://www.domain.com/somesubsection/

Again, make sure to change the domain name and directory to the actual URL and directory you wish to secure.

For more information on the configuration of your .htaccess file in your specific hosting environment please contact your hosting provider.