I have a set of code that redirects from a file called package.php
to a "pretty permalinks" structure. The problem is that it doesn't redirect to the https version of the page. I need to be able to redirect to https://www.example.com/package-type/airport-name/hotel-name. Here is the code:
#Redirects hotel pages to package.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /package.php?/$1 [L]
# Removes package.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*package\.php [NC]
RewriteCond %{REQUEST_URI} !/.* [NC]
RewriteRule (.*?)package\.php/*(.*) /$1$2 [R=301,NE,L]
I do have redirection code that detects if https is off and redirects to the correct version. But this code doesn't get called until after the above code.
#First rewrite
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
I am not looking to combine the two sections of code. That would break other pages that are not package pages. Instead I need the first set of code to redirect to https version of the pages.
Any help would be appreciated.