View Single Post
Old 03-10-2006, 01:25 PM   #1 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
mod_rewrite question

Alright, I have a question about mod_rewrite. I am pretty sure that this is what I need to use to go about what I would like to do.

Here is what I am doing. I have a website I am redoing ( www.coloradomountaincabins.com ). All of the cabins and such are going to be stored in a database now. Instead of each cabin having a page, I want to have one page (cabin.php) and use a variable to select the cabin they want to view, and then select that information from the database. I have it working so much as I can go to cabin.php?id=5 and it will display cabin 5. What I want to try now, is instead of having the url's like that, have the links all be say domain.com/cabin/05 and that will display cabin.php?id=5

From what I know, mod_rewrite will do this for me.. I have been looking around at various tutorials.. and have sort of an idea of how I would do this.. but I am confused by seeing that query strings are passed seperately.. how would I go about doing this......? Thank you in advance

Note: I am not going to link to the current page that I have these test pages on, because I know they have pretty wide open things in them that can be exploited right now. I am checking the id that I am using to submit to choose the cabin for length. If it is longer than 2 characters I am having the script die. Is there a better way that I can do this? I figure that would probably keep anything that somebody tries to inject way, because I figure it would be longer than 2 characters
DewKnight is offline   Reply With Quote