Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod_rewrite questions from a noob!



8:41 pm on Aug 10, 2005 (gmt 0)

10+ Year Member

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


[PHP]Options +FollowSymLinks
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.


1:40 am on Aug 11, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member


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.)



11:53 pm on Aug 11, 2005 (gmt 0)

10+ Year Member

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.

thanks again.


Featured Threads

Hot Threads This Week

Hot Threads This Month