Redirecting Subdomain to URL

I have a domain name hosted with a third party provider. I’m using the addon domain feature here to allow my website to be accessed using my domain. It’s working great, but I have a question about the subdomains. What I want to do is create a shortcut URL to a page on my website. Ideally I’d like it to work like this: if someone goes to name.mydomain.com, it would then take them to mydomain.com/page.html. Based on what I’m finding on the hosting side, the subdomain feature makes a whole new directory on the server. I don’t really want that, and it would be great if I could just change the subdomain directory to just point to a single page on my website. Is there a way to do such a thing? Is there something I’d need to change on the domain side rather than the hosting side?

This is how it works on all hosting providers. So, that’s that.

Try doing this:
Go to name.mydomain.com’s htdocs folder, and add an index.php with the following code:

<?php
header("Location: http://mydomain.com/page.html");
?>

This will simply forward visitors to mydomain.com/page.html. Please note that if you are accepting URL parameters, you will have to change the code a bit otherwise it won’t work.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.