LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache 2.x: http for some paths and https for other paths (https://www.linuxquestions.org/questions/linux-newbie-8/apache-2-x-http-for-some-paths-and-https-for-other-paths-4175416914/)

john lee 07-16-2012 02:26 AM

Apache 2.x: http for some paths and https for other paths
 
I am wondering if this can really be done in Apache.

I have installed several web applications on one single 2.x Apache server on Centos 6. I have installed SSL in Apache as well.

I would like to achieve the following:
For App A: user must access using https://samehostname.com/secure
For App B: user must access using http://samehostname.com/public

Any thoughts?

Wim Sturkenboom 07-16-2012 03:27 AM

Make everything go through SSL (https). I don't really see a reason why you want to use the mix of http/https for the setup you describe.

john lee 07-17-2012 02:33 AM

<VirtualHost _default_:80>
[...]
RewriteEngine on
RewriteRule ^/secure/(.*)$ https://%{SERVER_NAME}/secure/$1 [R=301,L]
[...]
</VirtualHost>


<VirtualHost _default_:443>
[...]
RewriteEngine on
RewriteRule ^/public/(.*)$ http://%{SERVER_NAME}/public/$1 [R=301,L]
[...]
</VirtualHost>


All times are GMT -5. The time now is 05:30 PM.