I have a business with a long URL, lets call it reallylongandhardtotypeonaphone.com. All of my customer sites get a new subdomain of this e.g. customer1.reallylongandhardtotypeonaphone.com.
I've recently purchased a much shorter URL, lets call it short.co.nz. I'd like to dynamically forward routes to any subdomain of short.co.nz to the longer URL without having to setup DNS or forwarding entries for all subdomains.
Does this make sense, and is this achievable?
Essentially I want a user to be able to browse to customerX.short.co.nz/index.html and be redirected to customerX.reallylongandhardtotypeonaphone.com/index.html
Many thanks in advance,
Here’s a standard script to redirect to a fixed domain:
<?php $url = "https://reallylongandhardtotypeonaphone.com"; header("Location: $url"); ?> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META http-equiv="Refresh" content="0;url=<?php print $url; ?>"> <TITLE>Sam Trenholme tweet redir</TITLE></HEAD><BODY> This web page should go to the link. If not, <A href="<?php print $url; ?>">go here</A>. </BODY></HTML>
If we just have every single subdomain of short.co.nz go here, we can make the above file be index.php, and make sure the web server is configured to have all of the subdomains of short.co.nz use a document root with the above file as index.php.