CodeIgniter Forums

Full Version: Forcing a redirect from HTTPS to HTTP for one controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've implemented my CodeIgniter 2.x site on a server with SSL and have included a .htaccess file with all the relevant redirects to force HTTPS. However, I need one part of my site to remain HTTP and I'm struggling with this because of the way CodeIgniter processes requests through the index.php file. I want to keep as HTTP and cron is of course a controller processed in the same way as all other controllers. So far, my .htaccess file looks like this:-

#secure htaccess file
<Files .htaccess>
order allow,deny
deny from all

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^(?!cron)(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

RewriteEngine On
#Remove index.php being displayed on pages
RewriteCond $1 !^(index\.php|images|attachments|email|css|js|robots\.txt)
RewriteRule ^/?(.*)$ /index.php?/$1 [L]

But I think this is wrong because there is no physical cron folder in the server directory which I think is where the confusion is. Does anyone know a simple fix on how to redirect just the one controller to force HTTP rather than HTTPS?