auto redirect from diretory url

D

Dan Nash

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
 
B

Brynn

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_Name"),
"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
 
B

Brynn

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 )
 
D

Dan Nash

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!! :eek:)
 
S

Steven Burn

Dan Nash said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,977
Members
47,556
Latest member
the lucky frog

Latest Threads

Top