.net ci olduğum için normalde aspx de asax içinde şu şekilde basitçe halledilebiliyor. Ya da plesk den zorunlu yönlendirmeyi aktif ettiğinizde otomatik tüm url ler https ye yönleniyor. Aynı mantık için php metodunu birisi açıklar muhtemelen.

protected void Application_BeginRequest(Object sender, EventArgs e)
{ if ( !Request.IsSecureConnection)
{ string path = string.Format("https{0}",
Request.Url.AbsoluteUri.Substring(4));
Response.Redirect(path);
}}

yada rewrite modulü ile :
<rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /></rule>