• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forcing a redirect from HTTPS to HTTP for one controller

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 mydomain.com/cron 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?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.