eddie_k
eddie_k

Reputation: 50

mod rewrite redirect all to https except one file

I would like to redirect all my pages so they use the HTTPS protocol except one path. I did find the following page ( mod_rewrite redirect all to https except one file ), but the solution provided there didn't work for me. I have also tried other solutions, all to no avail.

Here is my current code:

Options -Indexes
RewriteEngine On

# do nothing for my-awesome-path.php
RewriteRule ^keg-collars-studio\.php$ - [L]

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}

RewriteRule ^(.*)\.html$ $1\.php [QSA,L]

I have edited my post with the exact content and path. Any help is greatly appreciated.

Upvotes: 1

Views: 896

Answers (1)

anubhava
anubhava

Reputation: 785108

Try this .htaccess:

Options -Indexes
RewriteEngine On

# Turn SSL off everything but payments
RewriteCond %{THE_REQUEST} !/keg-collars-studio\.php [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=302]

RewriteRule ^(.+?)\.html$ $1.php [NC,L]

Upvotes: 1

Related Questions