Page 1 of 1

Mod-Rewrite for %20

Posted: Mon Aug 07, 2006 2:02 pm
by curseofthe8ball
Anyone know how to rewrite the spaces (%20) in a URL to convert them to hypens (-).

For example, http://www.acme.com/widget 101.shtml to http://www.acme.com/widget-101.shtml

AND

http://www.acme.com/whats new/widget.shtml
to
http://www.acme.com/whats-new/widget.shtml

Your help is appreciated!

Posted: Mon Aug 07, 2006 2:55 pm
by Chris Corbyn
Maybe just real spaces?

Code: Select all

RewriteRule    [\ ]     -

Posted: Tue Aug 08, 2006 1:53 pm
by curseofthe8ball
Not sure I follow that comment.

Do you have some code that I could try in the .htaccess file?

Posted: Tue Aug 08, 2006 1:59 pm
by Chris Corbyn
curseofthe8ball wrote:Not sure I follow that comment.

Do you have some code that I could try in the .htaccess file?
Err.... that was it ;)

Code: Select all

RewriteEngine On

RewriteRule  [\ ]    -
I haven't tested it but that's what springs to mind.

Posted: Tue Aug 08, 2006 4:55 pm
by curseofthe8ball
Unfortunately that doesn't seem to work.