CodeIgniter Forums

Full Version: htacess rule to exclude controller folder from a existing rule
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys

I have htaccess rule to redirect my full website to https, i would like to exclude controllers/api folder from this redirection and keep it with http instead https

1. here is the link calling folder controllers/api folder
http://apphotel.ch/app_fe_dev/api/profile?client=31&language=1

2. here below is my current htacess content

# File modified on Wed Sep 23 23:12:19 2015 by server
# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives
# php_value memory_limit "512M" 
# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives
# php_value upload_max_filesize "100M" 
# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives
# php_value post_max_size "100M" 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/api
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]]

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} ^/(?!source)
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
 
<IfModule !mod_rewrite.c>
  # If we don't have mod_rewrite installed, all 404's
  # can be sent to index.php, and everything works as normal.
  # Submitted by: ElliotHaughin
   ErrorDocument 404 /index.php
</IfModule>


3. my folder structure
app_fe_dev
-application
-- controllers
---- api (this folder to be exclued from https redirection we want to keep it http)
------ profile.php
------ welcome.php
------ register.php

thank you very much for your help

cheers 
Antony