Simple .HTACCESS Passing Variables

Posted by Willie Murray III on Stack Overflow See other posts from Stack Overflow or by Willie Murray III
Published on 2012-04-08T14:58:46Z Indexed on 2012/04/09 5:29 UTC
Read the original article Hit count: 415

Filed under:

Let's says I have a classifieds site which has a URL structure similar to the one which I have listed below:

Ex. http://takarat.com/openclassifieds/?category=iphone&location=tennessee

This is what shows up when I click "tennessee" as the location and then click on "iphone" as the category.

Now let's say this site has a search box and I wanted a URL which comes up after using this search box to show up as opposed to the previous URL. Let's say that whenever I search for the word "iphone" while WITHIN the iphone CATEGORY the following link shows up:

Iphone SEARCH Ex. http://takarat.com/openclassifieds/?s=iphone&category=iphone&location=tennessee

Ok, I want THAT iphone SEARCH to come up whenever anyone clicks Tennessee > Iphone..How would I do this [by the way, I want this to be dynamic so that I can use the code for different combinations of locations and products etc..I want the code to use the CATEGORY name to conduct the search basically]? I believe that this will involve "Passing varibles" from the original link... I am new to programming so I may have my terminology wrong.

Any help would be appreciated.

Thanks in advance.

TURN THIS:

takarat.com/openclassifieds/?category=iphone[var 1]&location=tennessee[var2]

INTO THIS:

takarat.com/openclassifieds/?s=iphone[var 1]&category=iphone[var 1]&location=tennessee[var2]

© Stack Overflow or respective owner

Related posts about .htaccess