[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

mod_rewrite help

Posted on 2004-10-26
11
Medium Priority
?
229 Views
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:  http://www.drunkdrinks.com/category.php?letter=a

into:  http://www.drunkdrinks.com/mixed_drink_recipes_letter/a

and http://www.drunkdrinks.com/category.php?pagenum=0&catid=8

into:  http://www.drunkdrinks.com/mixed_drink_recipes_category/0/8

Anyone know how to do this?  Thanks in advance!
0
Comment
Question by:jimday1982
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 

Expert Comment

by:radical_mit
ID: 12422240
Hello,

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.
T
0
 

Author Comment

by:jimday1982
ID: 12422293
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.
0
 
LVL 2

Expert Comment

by:brozzis
ID: 12428935

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 tokenizer.inc included whenever necessary,
<?php
  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:

http://myServer/myFile/param1/value1/param2/value2...

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

http://www.drunkdrinks.com/mixed_drink_recipes_category/0/8

bye...

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:basiclife
ID: 12429803
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
0
 
LVL 5

Expert Comment

by:basiclife
ID: 12429811
brozzis: The server would just return a 404 error without mod_rewrite wouldn't it?
0
 
LVL 2

Accepted Solution

by:
brozzis earned 1000 total points
ID: 12431072

no mod_rewrite is necessary, and still it works.
I used the "tokenizer.inc" 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
0
 
LVL 5

Expert Comment

by:basiclife
ID: 12431133
Hmmm. Nice workaround. I might haev to play with something like that. You learn something new every day. Thanks
0
 
LVL 2

Expert Comment

by:brozzis
ID: 12636209

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

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

649 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