homepage Welcome to WebmasterWorld Guest from 54.227.141.230
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Mod_rewrite questions from a noob!
1EightT




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

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 http://mydomain.com/?keyword=new%20york%20car%20accident%20attorney&level=1

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

 

jdMorgan




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

1EightT,

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

Jim

1EightT




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved