Vanity URLs

C

Chris Guimbellot

Hello,

I am trying to create vanity URLs (I think that's what they are called) that
link directly to an item's listing
page on my site. Currently, the urls are set up something like the
following:

http://www.mydomain.com/productinfo.asp?prodID=00000

I am trying to configure them to be something like this:

http://www.mydomain.com/products/00000

The reason why I want to do this is that we print a paper directory and I
would like to list the links in there.
I have tried creating a folder called products, and configuring it to
redirect to a redirect file using the following:
http://www.mydomain.com/redirect.asp?prodID=$S

The redirect file contained something to the effect of the following code:
<%
Response.Redirect("productinfo.asp?prodID=" &_
Replace(Request.Querystring("prodID"),"/",""))
%>

This worked great on my local testing server. The problem is that my hosting
provider would not configure the folder for the redirect. That said, is
there any way to do this another way? I think the one possible is to
configure your 404 Error page to pull the url and forward to the listing
page based on some item in that url. Has anyone done this? I
appreciate the help.

Thanks,

Chris
 
C

Chris Guimbellot

Alex,

Thanks for the response. I have a question. I have created the correct
404.asp page and it is successfully performing the server.transfer, but when
it gets to the product page, that page is not receiving the record. Do I
have to build code on that page to check to see if there is a Session
variable. The article never mentions it. If not, is it possible that it is
not passing the session variable. The text I get on the productinfo.asp page
is "Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record." which usually means no
variable was passed to it. Not sure what's going on here. I appreciate the
help,

Chris
 
A

Alex Goodey

Chris,

When you used to call the product page using productinfo.asp?prodID=0000 you
used Request.QueryString("prodID") to find which product was being called.

As server.transfer can't pass parameters in the querystring then the product
id gets stored in a session variable, so your products page must then read
what is in the session variable.

Response.Write Session("prodID") will write out what ever is held in the
session variable called prodID, use this to make sure it is returning what
you expect. If it is, you can then use Session("prodID") in your SQL
statement.
 
C

Chris Guimbellot

Alex,

Okay now, I got it working. There is only one problem. After the page is
loaded, the images will not load because they are referring to the wrong
folder. They are looking for "mydomain.com/products/images/image.jpg"
instead of "mydomain.com/images/image.jpg" like it should. The article
mentions that you can add as many nonexistent folders as necessary(e.g.
products/brand/model or products/brand/year/model). It looks like every time
I change the number of nonexistent folders, the image location will change.
Do I have to hard-code the images location (e.g
mydomain.com/images/image.jpg)? Currently, its "images/image.jpg". What do
you think. Thanks again.

Chris
 
B

Brynn

try putting /images/image.jpg

Brynn


Alex,

Okay now, I got it working. There is only one problem. After the page is
loaded, the images will not load because they are referring to the wrong
folder. They are looking for "mydomain.com/products/images/image.jpg"
instead of "mydomain.com/images/image.jpg" like it should. The article
mentions that you can add as many nonexistent folders as necessary(e.g.
products/brand/model or products/brand/year/model). It looks like every time
I change the number of nonexistent folders, the image location will change.
Do I have to hard-code the images location (e.g
mydomain.com/images/image.jpg)? Currently, its "images/image.jpg". What do
you think. Thanks again.

Chris

Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
 
T

Tom Kaminski [MVP]

Chris Guimbellot said:
Alex,

Okay now, I got it working. There is only one problem. After the page is
loaded, the images will not load because they are referring to the wrong
folder. They are looking for "mydomain.com/products/images/image.jpg"
instead of "mydomain.com/images/image.jpg" like it should. The article
mentions that you can add as many nonexistent folders as necessary(e.g.
products/brand/model or products/brand/year/model). It looks like every time
I change the number of nonexistent folders, the image location will change.
Do I have to hard-code the images location (e.g
mydomain.com/images/image.jpg)? Currently, its "images/image.jpg". What do
you think. Thanks again.

Just change it to "/images/image.jpg".
 
E

Evertjan.

Chris Guimbellot wrote on 20 jan 2004 in
microsoft.public.inetserver.asp.general:
Do I have to hard-code the images location (e.g
mydomain.com/images/image.jpg)? Currently, its "images/image.jpg".
What do you think. Thanks again.

<base href="...">
 
C

Chris Guimbellot

That worked. Thanks,

Chris

Brynn said:
try putting /images/image.jpg

Brynn




Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
 
B

Brynn

no problem ... I always do paths from the root like that :) ... I
think it is good practice to do so.

Brynn



That worked. Thanks,

Chris

Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
 

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

Similar Threads

Relative image URLs in HTML 3
Successful way to Rewriting URLs with ASP? 7
vanity URLs 1
Vanity URLs 2
Vanity URL Question? 3
<a href> & <asp:Hyperlink> 1
dashes in URLs 27
vanity URLs (2nd time) 2

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top