Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    69

    Configuring Apache to Mask Query Strings

    I'm interested in masking querystrings as paths in apache.

    Example:

    currently looks like:

    document.shh?something=2&somethingelse=true

    should look like:

    document.shh/something/2/somethingelse/true/


    Is there a straight forward way to do this?
    http://evilpuppy.com
    where developers gather...

  2. #2

    its elementary, watson =]

    its rather simple. basically, apache looks for a page it can serve, it loads it and gives it the rest of the request url as an environment var.

    all you have to do is make sure apache stops looking at, say, your 'script.php'. add a handler for .php (im assuming you already did that). after that, you need to get the rest of the request string and parse it to retrieve your variables.

    basically, you need to get the $_SERVER['REQUEST_URI'], take out the name of the current script (can be gotten from $_SERVER['SCRIPT_NAME']) and split() the query string on, say, '/' and each piece on the second delimiter you might have picked.

    good luck,
    paul

  3. #3
    SitePoint PHP Advisor - answering your PHP questions day and night!
    http://www.sitepoint.com

  4. #4
    Join Date
    Sep 2002
    Location
    Illinois
    Posts
    2,304
    read about MOD_REWRITE in apache documentation
    How's my programming? Call 1-800-DEV-NULL

  5. #5
    Join Date
    May 2002
    Posts
    69
    Thanks all

    http://evilpuppy.com
    where developers gather...

Posting Permissions

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