mod_rewrite help

Posted on 2004-10-26
Last Modified: 2010-03-04
This seems pretty simple, but I cannot get it to work for the life of me...

I'm looking to turn these urls:




Anyone know how to do this?  Thanks in advance!
Question by:jimday1982

    Expert Comment


    I would try and just the $_POST option within the <form> on the page before, these look like you are using $_GET

    so set you <form action="to the sub page" method="post">
    this should hide the ?letter=a for you .
    this might just help you with you problem.

    Author Comment

    Not really sure what you're talking about here - I'm not trying to mess with my forms (yet, anyway), I'm just trying to make some of my links more SE friendly.  Thanks for your reply though.
    LVL 2

    Expert Comment


    are you sure you want to solve this one with mod_rewrite ?

    place this code at the begin of the php file "mixed_drink_recipes_category"
    without extension. Remember to instruct your web server to use php to serve this file
    I placed this code in a file included whenever necessary,
      if (strstr($PATH_INFO, "/")) {
       $p = substr($PATH_INFO, 1);
       $e_path = explode("/", $p);
       $i = 0;
       while ($i < count($e_path)) {
        $name = $e_path[$i];
        $val = $e_path[$i+1];
        $$name = $val;
        $i = $i+2;

    in a file "myFile" without extension and then call it like this:


    it should be quite straightforward to modify this to accept a well defined order of parameters, like you want:


    LVL 5

    Expert Comment

    Ok, I don't know the answer because I'm after something similar myself but I just want to tell you you are going the right way about it - using mod_rewrite to convert "subdirectories" which don't exist into parameters for a PHP / other CGI script. Not sure why noone else is seeing it that way
    LVL 5

    Expert Comment

    brozzis: The server would just return a 404 error without mod_rewrite wouldn't it?
    LVL 2

    Accepted Solution


    no mod_rewrite is necessary, and still it works.
    I used the "" to hide parameters in GET calls, this is currently working.
    Server-side you must force on apache the use of php for every file requested,
    without checking for a .php extension, or use mod_rewrite to convert your calls
    FROM /mixed_drink_recipes_category TO /mixed_drink_recipes_category.php
    LVL 5

    Expert Comment

    Hmmm. Nice workaround. I might haev to play with something like that. You learn something new every day. Thanks
    LVL 2

    Expert Comment


    I gave a full and working solution...
    I think that basiclife should admit this...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles al…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now