I have a website with three hostnames x y and z. x is the main url and I have a valid SSL certificate for it. Basically, I have no problem if a page is accessed through http, however if an https page is requested when a users registers or when a user logs in or over a few https links I want the url to be redirected to from y and z to https://x
should go to https://x.com/test.php https://z.com/test.php
should go to https://x.com/test.php
Where test.php could be any URL.
In short, any https page requested if it is not going for hostname x it should be redirected to hostname x. Is it rewrite or redirect I need, or maybe I need both.
Any help please ?