Link to home
Start Free TrialLog in
Avatar of efkamel
efkamel

asked on

how can i provide a domain name to other users

i am developing a web site that allows other to create their domain name like www.myname.com where my name is the username?
Avatar of ManuelMSP
ManuelMSP

Which scripting language you use?

Here's a ASP solution:
Normally, domains can only be set-up so that they point to the root directory of your web site.  However, using ASP code, you can detect which URL a person is browsing to your site with, and redirect them to the appropriate place on your site.    The below code will work well.  Just name the files Default.asp and database, and place them in the <root> of your site:

Filename: Default.asp
<%
sname = Request.ServerVariables("Server_name")
sname = ucase(sname)
fPath = "database"
set fobj=server.CreateObject("scripting.filesystemobject")
fname=Server.MapPath(fpath)
Set f = fobj.GetFile(fname)
set fin=f.OpenAsTextStream (1, -2)
MyLine = ucase(fin.ReadAll)
TestLine = sname & "|"
testPos = InStr(MyLine, TestLine)
if testPos <> 0 then
SecondPipe = InStr((testPos + Len(TestLine)), MyLine, "|")
PosMatchEnd = (testPos + len(TestLine))
PosSecondEnd = SecondPipe - PosMatchEnd
RedirURL = mid(MyLine, PosMatchEnd, PosSecondEnd)
response.redirect lcase(RedirURL)
else
response.redirect "Default.htm"
end if
fin.close
%>
<html><head><title></title></head><body></body></html>

Filename: database
yourdomain.com|http://www.yourdomain.com/|
subdomain.com|http://www.yourdomain.com/subdomain/|
www.subdomain.com|http://www.yourdomain.com/subdomain/|

(The separators in this example are | 'pipe' symbols)
ASKER CERTIFIED SOLUTION
Avatar of ManuelMSP
ManuelMSP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to ManuelMSP

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
As recommended

Chmod
Community Support Moderator @Experts Exchange