Having trouble writing this compound rewrite containing the following rules:
Requirements:
- Redirect all http://example.com -> http://www.example.com
- Redirect all https://* -> http://wwws.*
- Enforce all /checkout/* page to use https:
E.G.
http://example.com/checkout/123 -> https://wwws.example.com/checkout/123 or http://example.com/checkout ->https://wwws.example.com/checkout/123
What i have currently done:
I currently have a series of rewrites that rewrites the non-www to the www:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This is problematic because when a http request for the URI: http://wwws.example.com it redirects that to http://www.wwws.example.com.
How would i achieve a rewrite that would satisfied my requirements?
Don't use HTTP_HOST:
My preference is for this:
Or much simplier:
Exercice left to the read: find more other ways.
To redirect https to http:
Or: