Welcome Guest, Not a member yet? Register   Sign In
.htaccess rewrite https on a specific URL
#1

[eluser]Mat Marlow[/eluser]
Hi,
I'm posting this in CI forum because I'm wondering if the CI htaccess file is causing me problems.

I'm trying to use a RewriteRule to set https for a certain path in my site ('offers'), and also turn it off for all other pages in my site.

The business part of my .htaccess file:
<code>
...
RewriteCond %{HTTPS} off
RewriteRule offers https://%{HTTP_HOST}%{REQUEST_URI} [L]

RewriteCond %{HTTPS} on
RewriteRule !offers https://%{HTTP_HOST}%{REQUEST_URI} [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
...
</code>

I can get the first rule to turn on https no problem, but when I add the second rule, it will turn of http for everything, but not turn it on for 'offers'.

Ideas anyone?

Thanks,
Mat




Theme © iAndrew 2016 - Forum software by © MyBB