$request->getProtocol() == 'http'
) {
$oldUrl = $request->getFullRequestURL();
- $redirUrl = str_replace( 'http://', 'https://', $oldUrl );
+ $redirUrl = preg_replace( '#^http://#', 'https://', $oldUrl );
if ( $request->wasPosted() ) {
// This is weird and we'd hope it almost never happens. This