Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Frienldy URLs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Frienldy URLs

 Post Reply Post Reply
Author
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Topic: Frienldy URLs
    Posted: 08 January 2005 at 5:58pm
For an application I design I need to convert an url like http://www.mypage.com/an_item to be redirected to an asp page. That is, if someone is typing the url http://www.mypage.com/an_item, instead of a 404, to be redirected to http://www.mypage.com/the_page_Im_actualy_looking_for.as p. I have no clues what "an item" might be, but it exists and it is grabbed from a database. The closest analogy is with an online store, where if someone is typing www.mystore.com/laps it would be redirected to a page like http://www.mypage.com/item_family.asp?item=lamps, which grabs and display all the items thar are listed in this category.
Cristian Banu
Soft 4 web
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2005 at 6:02pm
you can set redirects from most CP's  whos your host.

you can set a redirect (perminant)

Back to Top
Greyth View Drop Down
Newbie
Newbie


Joined: 21 May 2003
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greyth Quote  Post ReplyReply Direct Link To This Post Posted: 12 January 2005 at 7:56pm
You might try something like this.... Using this, you can do just about anything you want using a 404 page.



URL = Request.ServerVariables("QUERY_STRING")
URLname = Request.ServerVariables("QUERY_STRING")
if instr(1,URL,"404;http://") > 0 then
    'Error Page True
    ErrorPage = true
    URL = replace(replace(URL,"404;http://",""),"_"," ")
    if not mid(URL,len(URL)-1) = "/" then
        URL = URL + "/"
    end if
    URLPart = split(URL,"/")
    if ubound(URLPart) > 1 then
        vdir = lcase(URLPart(1))
    end if
    
end if   


IF left(lcase(vdir),5) = "products" THEN

    response.status = "200 OK"
    productID = replace(vdir, "products", "")
    response.redirect("wherever you want to redirect")

'////////////////////////////////////// You could also do a moved permenantly
'Response.Status="301 moved Permanently"
'Response.AddHeader "Location", "http://www.example.com/"
'//////////////////////////////////////

ELSE
    %><!--#include file="getTheProductsFromTheDB.asp" --><%
END IF



Edited by Greyth - 12 January 2005 at 8:00pm
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 13 January 2005 at 1:21am
Very clever solution greyth. Thank you, but it was suggested to me on another forum and I was working on it. Well, they say that great minds think alike Wink.

The entire article is here.
Cristian Banu
Soft 4 web
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.