Results 1 to 2 of 2

Thread: url rewriting help

  1. #1
    Join Date
    Sep 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default url rewriting help

    Hi

    I am new to this url rewriting thing and find it all very confusing. Could someone point me to a resource or give a little guidance here onto how to do this or show me a better way of doing it

    I have products pages that at present are displayed like this

    www.mywebsite.co.uk/products/display.asp?id=1

    Can I make it so that the link is

    www.mywebsite.co.uk/products/product_name/

    In the product list page, all products are currently linked to by the first link above, display.asp?id=2 and so forth. Would these links still work or would I need to change them?

    Thanks for the help, if I manage to do it I also have the news section that works in the same way that I would try and change

  2. #2
    Join Date
    Mar 2005
    Location
    Isle of Man
    Posts
    1,261
    Thanks
    3
    Thanked 24 Times in 24 Posts

    Default

    First off, you are probably best setting up a single schema to handle all products, and consequently you will need to include the product's id in the rewritten URL, or you would need to apply some logic in your application to take the word and find the relevant product page.
    I'm no ISAPI rewrite expert, but it would look something like this:
    Code:
    RewriteRule /products/(.*)/$ /display\.asp\?product_name=$1 [I,U,O]
    for example
    www.mywebsite.co.uk/products/widget/
    becomes
    www.mywebsite.co.uk/products/display.asp?product_name=widget

    or if you want to keep the same application logic you pass the id in the friendly url
    Code:
    RewriteRule /products/(.*)/(.*)/$ /display\.asp\?id=$1 [I,U,O]
    for example
    www.mywebsite.co.uk/products/1/widget/
    becomes
    www.mywebsite.co.uk/products/display.asp?id=1

    I've just rushed that off the top of my head, but I hope it acts as a starting point…
    Last edited by nick; 13th October 2007 at 12:17 AM. Reason: Escaped the page extension's period with a slash (\.asp)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. url rewriting help
    By slippers in forum Technical Support
    Replies: 1
    Last Post: 18th May 2007, 02:04 AM
  2. URL Rewriting question
    By roki13 in forum Technical Support
    Replies: 3
    Last Post: 9th February 2007, 09:01 AM
  3. URL rewriting
    By ninjalabs in forum Technical Support
    Replies: 1
    Last Post: 13th June 2005, 03:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •