CodeIgniter Forums
.htaccess - redirect http to https exclude specific url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: .htaccess - redirect http to https exclude specific url (/showthread.php?tid=65416)



.htaccess - redirect http to https exclude specific url - cuizhe - 06-09-2016

How to redirect http to https exclude specific url?

http://www.example.com/* => https://www.example.com/*

http://www.example.com/nonssl/* => http://www.example.com/nonssl/*


So I make .htaccess file following this:
Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/nonssl/
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

But when I go to http://www.example.com/nonssl/testfunc, it goes to https://www.example.com/index.php/nonssl/testfunc.

Thanks in advance.