cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

https to http for one subdirectory

Having purchased a SSL Godaddy certificate and also installing the .htaccess file as directed by Godaddy, I now need to have one subdirectory on my site available in http (with no security). With the Godaddy recommended .htaccess file, everything redirects to https. How do adjust the .htaccess file so the one subdirectory functions as http (without security)? Thank you!

3 REPLIES 3
Super User I Super User I
Super User I

Re: https to http for one subdirectory

So basically what you want is:

http://example.com            --> https://example.com
http://example.com/something/ --> https://example.com/shomething/
http://example.com/nohttps/   --> http://example.com/nohttps/ 

That should be possible? I'm guessing that your current file is something like:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

You can just add a second rewrite condition? 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/nohttps
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

That seems right? Of course replace the directory /nohttps with your own.  I hope that helps? Also let me know if that works for you. 

 

...turns out that my two cents is worth less or more depending on the current exchange rate.

roy darling *my posts seem a lot shorter in my head

Re: https to http for one subdirectory

Thanks for the reply. However, the htaccess code I am using is the one recommended by Godaddy for an "add-on" domain, so the code you recommended did not work.

 

My code looks like this:

 

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?MYURL\.org
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://www.MYURL.org/$1 [R,L]

 

With MYURL being the actual site name. I want a subdirectory off of this url to be not protected.

 

 

Super User I Super User I
Super User I

Re: https to http for one subdirectory

I don't know if the .htaccess modification needs to be different? In theory your addon domain pointed to a directory should work just like a root domain?

 

...turns out that my two cents is worth less or more depending on the current exchange rate.

roy darling *my posts seem a lot shorter in my head