Point a subdomain to a sub-directory?

  • Thread starter Thread starter Leon
  • Start date Start date
L

Leon

How do I point a sub-domain to a sub-directory or sub-web of my site using
asp.net?

I know normally domains are setup to point to the root directory of the web
site. However, how can I detect which URL a person is browsing to on my site
with ("such as leon.mydomain.com"), and redirect them to the appropriate
place on within site ("such as mydomain.com/help/leon05"), and where do I
want to put this code in default page of the website or in the global.asax
file.

Thanks!
 
You need to configure a new website in IIS and it can use the HTTP host header
to distinguish which website to access. Then in your second website configure
to map to any directory you want to.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
something like this would work right?

<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN1") <> 0 then
response.redirect "subdirectory to go to"
elseif InStr(sname,"DOMAIN2") <> 0 then
response.redirect "2nd subdirectory to go to"
end if
%>
 
Yes, I suppose that would work. The downside is that you'd have to code this
for every page, I presume? And what happens when you want to support a 3rd,
4th or 5th domain? Again, there are always two ways to skin a cat. I'd suggest
seeking out the sharper knife, though ;)

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
I do I do a doamin forward from where the domain is parked, but mask or is
it impossible? See example below..
Parked domain = www.mydomain .com
so I set-up a domain forward to www.maindomain .com, but I want the url to
keep showing mydomain.com.
 
Ah, but that's a security problem. The redirect is going to be your best
bet. The other hack I've seen is to make your first domain have a page that
contains a frame that points to the second domain. This sort of works, I
guess :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
thanks so much for your time, but what do you mean by "The other hack I've
seen is to make your first domain have a page that contains a frame that
points to the second domain"?
 
Back
Top