I have a domain, I'll call it "url.com".
I have a subdomain, I'll call it "subdomain.url.com".
Currently if "http://url.com" is visited or "http://subdomain.url.com" is visited they go to the exact same "index.html" page/website.
I want to have that "index.html" page recognize what URL was typed in to get to it so that if "http://subdomain.url.com" it will forward them to "http://url.com/directory/".
If "http://url.com" is typed in, I want the page to stay where it is.
How can I do this? My host does not allow subdomain forwarding.
Thank you!
Have a look at felgall's comments in
http://www.codingforums.com/showthread.php?t=107507
It's really quite easy. Just put this in the <HEAD> of your page:
<script type="text/javascript">
// <![CDATA[
var host = location.host;
if(host == "subdomain.url.com") location.href = "http://url.com/directory";
// ]]>
</script>