[thelist] replace chars in url with mod_rewrite

Richard Livsey Richard at livsey.org
Mon Jul 19 11:58:35 CDT 2004


Is it possible to mod_rewrite a URL to replace certain characters?

We host a site who use spaces in their filenames extensively. A third 
pary application they use creates links with the spaces replaced with 
'+' so links from this app break.
Unfortunately they can't change the app, or the filenames so we are 
forced to look at alternatives.

So the challenge is how to convert a URL like:
http://www.example.com/this+is+a+file.html
to:
http://www.example.com/this%20is%20a%20file.html

I've searched the mod_rewite docs but couldn't find anything of use.

Another resort is to make a custom 404 handler which will redirect to 
the correct URL, but mod_rewrite feels cleaner.

Thanks in advance.

-- 
R.Livsey
Incutio Web Developer
www.livsey.org
www.incutio.com



More information about the thelist mailing list