Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Mod_rewrite questions from a noob! 1EightT
Hi guys, I am completely new to mod rewrite, and through reading I have "some" idea of what I am doing, but I figure it is easier to just ask my questions here and learn from the code.
I have url's of varying length like this
RewriteEngine on RewriteRule //(.*)/(.*)/(.*)/(.*)/$ /?$1=$2&$3=$4[/PHP]
I used the above with some success, but what I really want to do it replace the %20 with a - and clean up the rest. Probably pretty simple.
The next part i'm more confused on is how I modify my php code in my source to use these new url's by default when the menu is built and such. Any help there would be huge as well.
Thanks in advance guys. I'm still trying to learn all this regex stuff.
Welcome to WebmasterWorld!
This search [ google.com] should turn up some good threads to get you started with rewriting static to dynamic URLs.
Modifications of code in
these threads [ google.com] may help you in getting rid of hex-encoded spaces (the regex to match a space in a RewriteRule is "\ " -- that is, backslash space.)
Thank you for the links, those helped a bunch. I ended up rewriting my code to replace the spaces with - to being with, then used some mod rewrite to get rid of the variables I didn't want. Finally I then modified the code for our menu system and such to spit out code without the variables as well (? = etc). Works perfectly and the url's are just how they should be.