homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Using mod_rewrite to redirect from URL with spaces

10+ Year Member

Msg#: 217 posted 9:16 pm on May 23, 2003 (gmt 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?




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

Msg#: 217 posted 11:25 pm on May 23, 2003 (gmt 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]


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved