Mod-Rewrite for %20

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

Mod-Rewrite for %20

Post 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!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Maybe just real spaces?

Code: Select all

RewriteRule    [\ ]     -
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

Post by curseofthe8ball »

Not sure I follow that comment.

Do you have some code that I could try in the .htaccess file?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
curseofthe8ball
Forum Commoner
Posts: 73
Joined: Sun Jun 01, 2003 12:33 am

Post by curseofthe8ball »

Unfortunately that doesn't seem to work.
Post Reply