Can I have a folder use http even though the domain uses https?

Started by emar, January 16, 2019, 02:21:41 AM

Previous topic - Next topic

emar

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

Netino

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:

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:

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

emar

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.