Creating subdomain in URL alaising
I am creating a social networking site and one of the requirements is to have the subdomain like URL for each user. For example, for the user1 his profile page will be user1.mysitename.com and for the user2 profile page will be user2.mysitename.com.
Can it be done using url aliasing? b开发者_Go百科asically user1.mysitename.com should be www.mysitename.com/profile.aspx?username=user1
I will be hosting this in windows 2003 (IIS6), any help is highly appreciated.
You can either respond to each GET
request of user1.mysitename.com
with the same contents as www.mysitename.com/profile.aspx?username=user1
or you can answer using a redirection (HTTP 302 response) from the first url to the second url.
However, you have to first make sure the DNS server who is authoritative on mysitename.com is aware to all these domains and respond with the answer you need (either the IP of the server, or a CNAME to a domain that is linked to an IP).
EDIT:
When someone will try to surf to user1.mysitename.com
he will first try to resolve user1.mysitename.com
to get it's IP - here you need someone to let him know what is the IP of the domain user1.mysitename.com
.
After the user has the IP of the domain, he will request the page using HTTP GET
request. You need to respond to it somehow. One way is to redirect him to a different URL (www.mysitename.com/profile.aspx?username=user1
). Another way is to simply respond to the GET
request and give him the page he's looking for.
精彩评论