I have a directory structure such as:
/root/sub1/sub2/file.php
My .htaccess file looks like:
rewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^sub1(.*) https://%{SERVER_NAME}/sub1$1 [R,L]
This rewrites the access to /root/sub1/* as requiring https. This is great. However I have one exception.
I have a file in sub2 that I do NOT want to be SSL protocol (https). How can I enable access to this one file via http without destroying my global https setting?
I.e. /root/sub1/sub2/file1.php - stay http
/root/sub1/* - require https
The way I dealt with this kind of problem was actually pretty poor, but it works. I have the reverse situation: one page in my docroot needs to be accessed by HTTPS. To do that, I just checked to see if the server port wasn't 443. If not, I used the location header to reset it.
Bookmarks