Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Using mod_rewrite to redirect from URL with spaces

9:16 pm on May 23, 2003 (gmt 0)

New User

10+ Year Member

joined:May 23, 2003
votes: 0

I am redesigning a website from scratch, but I need to keep the existing link structure. Several of the old pages have URLs with spaces in them, which I want to redirect, but with my limited mod rewrite knowledge (all of which I owe to this forum) I can't figure out how to incorporate a space into the url of a rewrite rule.

I'm hoping there is a regex rule that can fulfill this (seemingly simple) need, which is basically this:

RewriteRule ^url with spaces\.htm$ /store/redesignedurl.php [L]

Can any of the mod rewrite gurus out there help?


11:25 pm on May 23, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0


Welcome to WebmasterWorld [webmasterworld.com]!

Escape the spaces with a preceding "\" just like the dot in "\.html" in your example.

If you want the search engines to transfer your PR/link pop to the new URLs, use [R=301,L] for your flags.

With those changes, the rule you have should work.

Ref: Introduction to mod_rewrite [webmasterworld.com]



Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members