Author Topic: Can I have a folder use http even though the domain uses https?  (Read 5075 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Can I have a folder use http even though the domain uses https?
« on: January 16, 2019, 02:21:41 AM »
Hi,

I have a domain secured with https, so any http requests are forced to https.
But I have a directory on that domain that's used from something else that won't accept https requests.
I guess what I'm wondering is can I have that directory use http instead of https?
Someone said I can do it with .htacces but not sure how.

How do I achieve this?

Thanks
« Last Edit: January 16, 2019, 02:26:27 AM by emar »

Offline
***
Re: Can I have a folder use http even though the domain uses https?
« Reply #1 on: January 17, 2019, 02:26:10 AM »
Yes, is possible.

Check:
https://stackoverflow.com/questions/17638645/force-https-except-for-one-directory

For example, if you are already using the following to redirect:
Code: [Select]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

And you need the directory 'mydir' to get exception ont that redirect, you can change it to use:
Code: [Select]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !mydir [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This should be the content of the '.htaccess'  file in your main directory.

Regards,
Netino

Offline
*
Re: Can I have a folder use http even though the domain uses https?
« Reply #2 on: January 17, 2019, 09:33:29 PM »
Thanks Netino,

If I knew this I wouldn't have moved the scripts to a non ssl secured domain :)
But this is handy to know thanks a lot.