Miva - Sample of HTTPS Migration with .htaccess Environmental Variables
RewriteEngine On
# ------------------------------------------------------------------------------
# | HTTPS Environmental Variable Helpers |
# ------------------------------------------------------------------------------
RewriteRule .* - [E=ForceHTTPS:FALSE]
# RewriteCond %{REMOTE_ADDR} ^207\.114\.171\.26$ [OR]
RewriteCond %{HTTP_COOKIE} ForceHTTPS [OR]
RewriteCond %{HTTP_USER_AGENT} ForceHTTPS [OR,NC]
RewriteCond %{QUERY_STRING} ForceHTTPS [NC]
RewriteRule .* - [E=ForceHTTPS:TRUE]
# ------------------------------------------------------------------------------
# | Force HTTPS (Depending on Environmental Variable) |
# ------------------------------------------------------------------------------
# RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{SERVER_PORT} !443
RewriteCond %{ENV:ForceHTTPS} TRUE
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,NC,QSA]
# ------------------------------------------------------------------------------
# | Miva - Legacy Short Link SEO Settings |
# ------------------------------------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{ENV:ForceHTTPS} FALSE
RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{ENV:ForceHTTPS} FALSE
RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{ENV:ForceHTTPS} FALSE
RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [QSA,L]
# ------------------------------------------------------------------------------
# | Miva - URI Management |
# ------------------------------------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{ENV:ForceHTTPS} TRUE
RewriteCond %{REQUEST_URI} !^/mm5/.*$
RewriteRule ^(.*)$ /mm5/uri.mvc? [QSA,L]