If you have ClientExec installed in a sub-directory say /clientexec and want to require HTTPS only for ClientExec the easiest way to accomplish this is by putting a .htaccess file inside of the sub directory itself. There are numerous solutions to this posted as CE Knowledge Base Articles and within the CE forums but many of them did not work for me so I wanted to post the solution that worked on setup using CentOS as the operating system and using Apache/PHP/MySQL on that platform.
Verify Apache mod_rewrite Is Installed:
- [root@centos-dev ~]# cat /etc/redhat-release
- CentOS release 5.8 (Final)
- [root@centos-dev ~]#
- [root@centos-dev ~]# ls /etc/httpd/modules/ | grep -i rewrite
- mod_rewrite.so
- [root@centos-dev ~]#
- [root@centos-dev ~]# cat /etc/httpd/conf/httpd.conf | grep -i rewrite
- LoadModule rewrite_module modules/mod_rewrite.so
- [root@centos-dev ~]#
So first I am just showing that the version of Linux is CentOS 5.8. Next we look to see if the module exists on the server followed by verifying that it is loaded in the Apache configuration file which on CentOS is /etc/httpd/conf/httpd.conf. Now that you have verified mod_rewrite is installed and enabled you should be able to add the below contents to a file in the sub directory where ClientExec is installed.
.htaccess File Contents To Redirect ClientExec To HTTPS:
- RewriteEngine On
- RewriteCond %{SERVER_PORT} !^443$
- RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Verify the permissions are set to the proper level for your configuration which in my case is “644” and .htaccess files are blocked from being viewed via the Apache configuration. Also verify that the .htaccess file is allowed to override the necessary Options that may or may not be set. Once you have verified these items and restarted Apache all traffic destined for the ClientExec sub directory should be redirected automatically from HTTP to HTTPS for a secure connection which your clients will appreciate!