Reputation: 1
I have a codeigniter project. Here is the .htaccess file of it:
RewriteEngine on
#HTTPS redirection
RewriteCond %{HTTPS} =off
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#CodeIgniter Rules
RewriteCond $1 !^(index\.php|css|img|js|fonts|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Basically I am redirecting all non https traffic to https. My problem is that I was to exclude one codeigniter controller and all its URLs from this redirect. Some of the controller URL structure are:
http://example.com/external/?url=blablabla
http://example.com/external/
http://example.com/external/out/543260
http://example.com/external?goto=blablablabla
So these are codeigniter URLs. They are NOT files or directories. I already tried every possible RewriteCond to exclude these URLs but it's not working.
How can I exclude these codeigniter routed urls from the HTTP -> HTTPS redirection?
Upvotes: 0
Views: 490
Reputation: 1
I think I know where the problem is. the /external/ is a codeigniter module and as a result, it gets rewritten to /index.php?/external . The index.php is rewritten to HTTPS and that's why it's getting rewritten to HTTPS. All I have to do is to exclude index.php?/external from the HTTPS rewrite rule.
Upvotes: 0