virtuexru Posted July 10, 2008 Share Posted July 10, 2008 Hey guys, Haven't been on the site for awhile. Been doing some freelance work with C#. Now I'm back into some PHP/MySQL development and need a little help. I currently have a PHP page that calls information like this: http://*****.com/inventory.php?id=6026&m=TOYOTA&md=CAMRY I want it re-written so that it show's up like this: http://*****.com/inventory/toyota/camry/6026 or http://*****.com/cars/toyota/camry/6026 Can anyone help me out on how to do key in on this? I know I have to do it through .htaccess. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/ Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 Why reinvent the wheel... this should help you http://www.4webhelp.net/tutorials/misc/mod_rewrite.php Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586660 Share on other sites More sharing options...
tibberous Posted July 10, 2008 Share Posted July 10, 2008 It's like hardest thing in the word to do. Here is the cheat sheet: http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet/ I do it on flashgamereviews.com, but I had to play with it forever. Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586665 Share on other sites More sharing options...
virtuexru Posted July 10, 2008 Author Share Posted July 10, 2008 Damn, thought this would be a simple fix. Thanks for the links, will read through them now. Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586756 Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 Damn, thought this would be a simple fix. Thanks for the links, will read through them now. It's actually quite simple... to me at least. Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586768 Share on other sites More sharing options...
virtuexru Posted July 10, 2008 Author Share Posted July 10, 2008 RewriteRule /inventory/([0-9]+)/BMW/M3 /inventory_detail.php?id=5991&m=BMW&md=M3 Is that the right track? How do I put in whatever is dynamic, like for instance: "$m" will always be a make, like BMW or CADILLAC how do I integrate that? Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586799 Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 It uses a flavor of RegEx to perform the rewrite... If it's simple and you don't feel like learning regex, this little do-hickey works wonders http://www.mod-rewrite-wizard.com/ Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586831 Share on other sites More sharing options...
virtuexru Posted July 10, 2008 Author Share Posted July 10, 2008 It uses a flavor of RegEx to perform the rewrite... If it's simple and you don't feel like learning regex, this little do-hickey works wonders http://www.mod-rewrite-wizard.com/ Awesome. Thanks man. Link to comment https://forums.phpfreaks.com/topic/114138-re-writing-urls-need-some-help-phpfreaks/#findComment-586911 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.