SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast Fender963's Avatar
    Join Date
    Dec 2003
    Location
    Texas
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mod_rewrite, thorughly confused.

    After thoroughly confusing myself I just decided to ask for help with this:

    I would like it so that if
    http://www.plantedtank.net/plantprofiles/45/
    we typed in
    it would redirect them to
    http://www.plantedtank.net/plantprofiles.php?id=45

    Only instead of 45 it would be any number.

    Thank you very much!

    Kyle

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Fender,

    Hmmm, TOO EASY!
    Code:
    RewriteRule ^/?plantprofiles/([0-9]+)/?$ plantprofiles.php?id=$1 [L]
    That's looking for plantprofiles/ followed by one or more digits and (maybe) a trailing slash and will redirect to your script with the query string id=digits.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Enthusiast Fender963's Avatar
    Join Date
    Dec 2003
    Location
    Texas
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Superb. Thank you!

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Fender,

    GREAT!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •