Question

I need to rewrite all pages and assets to https, with exceptions for a couple specific pages. Here's my current htaccess code, which works fine for the broad https rewrite. I just need to figure out how to add page-specific exceptions to this.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

The pages I want to exclude are as follows:

  • cron.php
  • mailer_confirmjob.php
  • mailer_followup.php
  • cron_duplicate_check.php
  • mailer_periodicfollowup.php

Thanks!

Was it helpful?

Solution

You can use:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^((?!(cron|mailer_confirmjob|mailer_followup|cron_duplicate_check|mailer_periodicfollowup)\.php).*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top