Forum Moderators: phranque
# Externally redirect to remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://www.mysite.co.uk/$1 [R=301,L]
# Redirect Non www to www
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.mysite.co.uk [NC]
RewriteRule ^(.*)$ http://www.mysite.co.uk/$1 [R=301,L]
#Redirect https requests to non checkout pages to http
RewriteCond %{HTTPS}=on
RewriteCond !^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed)/?(.*)/?$ http://www.mysite.co.uk/$1/$2 [R=301,L]
#Redirect http requests to checkout pages to https
RewriteCond %{HTTPS} !=on
RewriteRule ^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed)/?(.*)/?$ https://www.mysite.co.uk/$1/$2 [R=301,L]
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.the-emporium.co.uk [NC]
RewriteRule ^(.+)$ http://www.the-emporium.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTPS} =on
RewriteRule ^(.+)/$ https://www.the-emporium.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTPS} !=on
RewriteRule ^(.+)/$ http://www.the-emporium.co.uk/$1 [R=301,L]
RewriteCond %{HTTPS} =on
RewriteRule !^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed|account-details) http://www.the-emporium.co.uk%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed|account-details) https://www.the-emporium.co.uk%{REQUEST_URI} [R=301,L]
Options +FollowSymLinks
RewriteEngine On
#
RewriteBase /
#
# Externally redirect HTTPS requests for non-secure pages to HTTP, also removing any
# trailing slash if present. Note that requests for object URL-paths shared between HTTP
# and HTTPS pages are excluded to prevent "Mixed secure/non-secure content" warnings.
RewriteCond %{HTTPS} =on
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond $1 !^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed|account-details)/?$
RewriteRule ^(([^/]+/)*[^/]+)/?$ http://www.the-emporium.co.uk/$1 [R=301,L]
#
# Externally redirect HTTP requests for secure pages to HTTPS, also removing any trailing slash if present
RewriteCond %{HTTPS} !=on
RewriteRule ^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed|account-details)/?$ https://www.the-emporium.co.uk/$1 [R=301,L]
#
# Externally redirect to remove trailing slash, preserving the originally-requested HTTP/HTTPS
# protocol unless the requested URL-path resolves to a physically-existing directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTPS}s ^(on(s)|offs)$
RewriteRule ^(.+)/$ http%2://www.the-emporium.co.uk/$1 [R=301,L]
#
# Externally redirect non-blank, non-canonical hostname requests to the canonical hostname, preserving
# the originally-requested HTTP/HTTPS protocol. Note that FQDN-format hostnames, hostnames having an
# appended port number, and mis-cased hostname requests will all get redirected.
RewriteCond %{HTTP_HOST} !^(www\.the-emporium\.co\.uk)?$
RewriteCond %{HTTPS}s ^(on(s)|offs)$
RewriteRule ^(.+)$ http%2://www.the-emporium.co.uk/$1 [R=301,L]
# Externally redirect HTTPS requests for non-secure pages to HTTP, also removing any
# trailing slash if present. Note that requests for object URL-paths shared between HTTP
# and HTTPS pages are excluded to prevent "Mixed secure/non-secure content" warnings.
RewriteCond %{SERVER_PORT} =443
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond $1 !^(cart|order-details|confirm-order|transaction-registration|order-successful|order-failed|account-details)/?$
RewriteRule ^(([^/]+/)*[^/]+)/?$ http://www.my-site.co.uk/$1 [R=301,L]