I’ve got a php script that forwards the user based on what subdomain the wrote in the url.
Now, normally you would read the HTTP_URI, but my webhost are using iframe, so I have to read the HTTP_REFERRER.
now to the problem, when accessing the site “normal”, like mysite.com or
it works fine, however, when using https, it only shows a white page.
This is my code:
<?PHP $REFERRER = $_SERVER['HTTP_REFERER']; // Or other method to get a URL for decomposition $domain = substr($REFERRER, strpos($REFERRER, '://')+3); $domain = substr($domain, 0, strpos($domain, '/')); // This line will return 'en' of 'en.example.com' $subdomain = substr($domain, 0, strpos($domain, '.')); //Echo $subdomain; header("Location: https://example2.com/'$subdomain"); ?>
.. Anybody got any suggestions?
Rewriting doesn’t work on subdomains on this server.