CloudSurferUK
CloudSurferUK

Reputation: 95

Exclude a specific directory from SSL

I have the following URL rewrite in htaccess to redirect URLS first to https and secondly to WWW if its not already. using the following code:

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^index.php/fsukblog/(.*)$ https://www.thisdomain.com/index.php/blog/$1 [L,R=301]

what I want to do is to exclude index.php/acars from the SSL so it works via http as a 3rd party piece of software connects to scripts within acars and wont work over SSL.

Upvotes: 1

Views: 1189

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

To redirect http to https://www, and to exclude /index.php/acars from https redirection, you can use

RewriteEngine on
RewriteCond %{HTTPS} OFF [NC]
RewriteCond www.%{HTTP_HOST} ^(?:www\.)?(www\..+)$ [NC]
RewriteRule !^index\.php/acars https://%1%{REQUEST_URI} [NE,L,R]

Upvotes: 1

Related Questions