DennisJM
DennisJM

Reputation: 29

http to https EXCEPT

I am using this to redirect all requests for http pages to https. However, I need to exclude certain pages on the site that must remain http. I am at a loss how to do this. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.reny.net/$1 [R,L]

Upvotes: 0

Views: 71

Answers (1)

Ben
Ben

Reputation: 5129

Use RewriteCond to check %{REQUEST_URI} before the RewriteRule

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} !^(/page1|/page2)$
RewriteRule ^(.*)$ https://www.reny.net/$1 [R,L]

Upvotes: 0

Related Questions