469,353 Members | 2,066 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

auto redirect from diretory url

Hi

Subject line doesn't make sense I know. Basically we have a number of people
on our system. They can sign up automatically and create their page.

What I want to be able to do is give them their own url (eg.
www.mydomain.com/theirsite).

Because they can sign up without our interference, I need some way of
creating a directory, with an index page that goes to their site, or some
way of mydomain.com's index.asp reading the "/theirsite" and redirected to
wherever it needs to go (viewartist.asp?id=them). Is that possible or will
the web browser always try and go to a the "/theirsite" directory?

Thanks for your help!
Dan
Jul 19 '05 #1
5 2375
Use a custom 404 for this. http://www.aspfaq.com/show.asp?id=2162 Just be
sure to restrict any names of directories you use or may possibly want to
use in the future. Like, don't let someone create an account with "images"
as his name or something.

Ray at work

"Dan Nash" <da********@musoswire.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
Hi

Subject line doesn't make sense I know. Basically we have a number of people on our system. They can sign up automatically and create their page.

What I want to be able to do is give them their own url (eg.
www.mydomain.com/theirsite).

Because they can sign up without our interference, I need some way of
creating a directory, with an index page that goes to their site, or some
way of mydomain.com's index.asp reading the "/theirsite" and redirected to
wherever it needs to go (viewartist.asp?id=them). Is that possible or will
the web browser always try and go to a the "/theirsite" directory?

Thanks for your help!
Dan

Jul 19 '05 #2

I have a similar project for users ...

I use ASP to create the directory, and copy a defualt.asp file of mine
into it ... the asp file goes something like ...

-- default.asp --

<%
Dim userName
userName = Replace(Replace(Request.ServerVariables("Script_Na me"),
"default.asp", ""), "/", "")
Response.Redirect("/viewartist.asp?userid=" & userName)
%>
OR BETTER YET ... ANOTHER PROJECT I HAVE WORKED ON

I just wrote the asp file upon user creation

<%
'// Code to create directory

'// Code to write a new asp file
%>

-- default.asp --

<%
Response.Redirect("/viewartist.asp?userid=123456")
%>
This second solution is better ... just when you create the user
account make sure that their name is not in the list of folders you
are using for site creation ... what I always do is just have all of
my folders start with an underscore ... and not allow any usernames to
start with an underscore ... with username validation this is a sinch
.... AND it keeps your folders alphabetically first for easy sorting.

just a thought ... I haven't tried using the 404 ... but would be
nervous doing so ... besides ... if they have images or anything ....
you can do what I did and create

/username/images/
/username/statictextdata/

Another thing I did ...
I kept all of their data in the database, but wrote other parts to
their statictextdata folder so the database wasn't being hit all the
time for viewing.

I almost ALWAYS do this for my advanced shopping systems. products are
ADDED, UPDATED, DELETED ... MUCH MUCH less than SELECTED

In my shopping systems I generally have all products in a database,
have it where they can be added to, updated, deleted through a UI ...
then have a button to "SEND CHANGES TO WEBSITE" ((althought
technically they are on a website .. their extranet.
Then, send changes writes over the products in a textdata/products/
folder ... usallly in the form of FULL pages of products html

Anyway ... too much info ... sorry


On Thu, 8 Jan 2004 12:32:20 -0000, "Dan Nash"
<da********@musoswire.co.uk> wrote:
Hi

Subject line doesn't make sense I know. Basically we have a number of people
on our system. They can sign up automatically and create their page.

What I want to be able to do is give them their own url (eg.
www.mydomain.com/theirsite).

Because they can sign up without our interference, I need some way of
creating a directory, with an index page that goes to their site, or some
way of mydomain.com's index.asp reading the "/theirsite" and redirected to
wherever it needs to go (viewartist.asp?id=them). Is that possible or will
the web browser always try and go to a the "/theirsite" directory?

Thanks for your help!
Dan


Jul 19 '05 #3
Although, the 404 redirect seems to be working fine for aspfaq.com I
may have to play with it.

But my way will work if you do not have access to manipulate the 404
... which some providers don't give (the bad evil ones )

On Thu, 08 Jan 2004 17:41:33 GMT, z@z.com (Brynn) wrote:

I have a similar project for users ...

I use ASP to create the directory, and copy a defualt.asp file of mine
into it ... the asp file goes something like ...

-- default.asp --

<%
Dim userName
userName = Replace(Replace(Request.ServerVariables("Script_Na me"),
"default.asp", ""), "/", "")
Response.Redirect("/viewartist.asp?userid=" & userName)
%>
OR BETTER YET ... ANOTHER PROJECT I HAVE WORKED ON

I just wrote the asp file upon user creation

<%
'// Code to create directory

'// Code to write a new asp file
%>

-- default.asp --

<%
Response.Redirect("/viewartist.asp?userid=123456")
%>
This second solution is better ... just when you create the user
account make sure that their name is not in the list of folders you
are using for site creation ... what I always do is just have all of
my folders start with an underscore ... and not allow any usernames to
start with an underscore ... with username validation this is a sinch
... AND it keeps your folders alphabetically first for easy sorting.

just a thought ... I haven't tried using the 404 ... but would be
nervous doing so ... besides ... if they have images or anything ....
you can do what I did and create

/username/images/
/username/statictextdata/

Another thing I did ...
I kept all of their data in the database, but wrote other parts to
their statictextdata folder so the database wasn't being hit all the
time for viewing.

I almost ALWAYS do this for my advanced shopping systems. products are
ADDED, UPDATED, DELETED ... MUCH MUCH less than SELECTED

In my shopping systems I generally have all products in a database,
have it where they can be added to, updated, deleted through a UI ...
then have a button to "SEND CHANGES TO WEBSITE" ((althought
technically they are on a website .. their extranet.
Then, send changes writes over the products in a textdata/products/
folder ... usallly in the form of FULL pages of products html

Anyway ... too much info ... sorry


On Thu, 8 Jan 2004 12:32:20 -0000, "Dan Nash"
<da********@musoswire.co.uk> wrote:
Hi

Subject line doesn't make sense I know. Basically we have a number of people
on our system. They can sign up automatically and create their page.

What I want to be able to do is give them their own url (eg.
www.mydomain.com/theirsite).

Because they can sign up without our interference, I need some way of
creating a directory, with an index page that goes to their site, or some
way of mydomain.com's index.asp reading the "/theirsite" and redirected to
wherever it needs to go (viewartist.asp?id=them). Is that possible or will
the web browser always try and go to a the "/theirsite" directory?

Thanks for your help!
Dan


Jul 19 '05 #4
Hi Guys

Thanks a lot for your replies. Some interesting ideas...

I'm gonna have a go with the 404 idea first of all, for two reasons...

1) I do have 404 access (I think)

and 2) it would take me a whole day to rename all the directories with a "_"
in front. I will however do that by standard in all future websites, in case
I ever need to do something with directories!!

Thanks again, and I'll be back if I have any trouble!! :o)
"Dan Nash" <da********@musoswire.co.uk> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
Hi

Subject line doesn't make sense I know. Basically we have a number of people on our system. They can sign up automatically and create their page.

What I want to be able to do is give them their own url (eg.
www.mydomain.com/theirsite).

Because they can sign up without our interference, I need some way of
creating a directory, with an index page that goes to their site, or some
way of mydomain.com's index.asp reading the "/theirsite" and redirected to
wherever it needs to go (viewartist.asp?id=them). Is that possible or will
the web browser always try and go to a the "/theirsite" directory?

Thanks for your help!
Dan

Jul 19 '05 #5
Dan Nash <da********@musoswire.co.uk> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
Hi Guys

Thanks a lot for your replies. Some interesting ideas...

I'm gonna have a go with the 404 idea first of all, for two reasons...

1) I do have 404 access (I think)

and 2) it would take me a whole day to rename all the directories with a "_" in front. I will however do that by standard in all future websites, in case I ever need to do something with directories!!

</snip>

Actually, it wouldn't take that long if you wrote a script to do it for you.

Pseudo code;

Dim FSO
Dim Fldr
Dim SubFldr

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fldr = FSO.GetFolder(Server.MapPath("./")).SubFolders 'current
Folder

For Each SubFldr in Fldr
'whatever code you want to use (If/Then etc) to re-name them
'Something along the lines of the following should suffice
If Not Left(SubFldr.Name, 1) = "_" Then
SubFldr.Name = "_" & SubFldr.Name
End If
Next

Set FSO = Nothing
Set Fldr = Nothing
Set SubFldr = Nothing

I've not checked this as I don't have time right now, so you may want to
check it before running it.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by mr_buggerlugs | last post: by
3 posts views Thread by blu3g85 | last post: by
5 posts views Thread by Josselin | last post: by
1 post views Thread by walkerhunter | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.