mod_rewrite and replacing characters

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
visionmaster
Forum Contributor
Posts: 139
Joined: Wed Jul 14, 2004 4:06 am

mod_rewrite and replacing characters

Post by visionmaster »

Hi,

I have following rule:

Code: Select all

RewriteEngine On
RewriteRule ^suchmaschine/(.*)\.html
/modules/mod_search.php?action=startSearch&suche[searchstring]=$1&suche[results]=10&suche[bundesland]=18&modus=all
This does following mapping:

suchmaschine/steel.html
=> /modules/mod_search.php?action=startSearch&suche[searchstring]=steel&suche[results]=10&suche[bundesland]=18&modus=all

I would like to extend my RegExp to replace underscore _ to %20 (space) like this:

suchmaschine/steel_case.html
=> /modules/mod_search.php?action=startSearch&suche[searchstring]=steel%20case&suche[results]=10&suche[bundesland]=18&modus=all

How to?

Thanks,
visionmaster
Post Reply