How to enforce  https for all the web access on apache web server

sudhirgoogle
sudhirgoogle used Ask the Experts™
on
Hello Experts,

I would like to know how to enforce https for all web access to Apache server ? and how do i verify whether https has been already enabled or not ??

The Apache server hosts multiple web applications on different ports, around 15 application has been hosted on the apache server, i want to verify whether https has been enforced or not for all those hosted applications ? Please help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
RewriteEngine On
          RewriteCond %{HTTPS} !=on
          RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]



https://support.comodo.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1245
Distinguished Expert 2017

Commented:
it alldependson your setup.  Ssl requires unique combination of ip/port

Author

Commented:
Fine. i can provide the information you need. i understand that adding those lines will enforce the https.

How do i ensure https has been enforced for all accessible URLs on the Apache server.

I have few many Direcotry tags in httpd.conf file, do i need to add those lines in all directory tags ?? Please help.
Distinguished Expert 2017
Commented:
The redirect that matches any and all requests on the insecure http: for each domain, will redirect any request for http://anydomain/* to https://anydomain/* where * represents any page.
You would need to add the redirect within each
<VirtualHost *:80>
ServerName domain1.com
redirect /(.*) https://www.domain1.com/$1
</VirtualHost>


The problem with multiple sites is that you can not have multiple unrelated domains using SSL on the same IP/port.
The option here is to have multiple public IPs that will map external_ip1 port 443 to internal_ip1 port 443 for domain1.com until external_ipn port 443 to internal_ipn port 443 for domainn.com.
<virtualhost internal_ip1:443>
ServerName domain1.com
DocumentRoot
.
.
.
.
</VirtualHost>

Author

Commented:
thanks for your solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial