Welcome to WebmasterWorld Guest from 54.234.63.187

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Using mod_rewrite to redirect from URL with spaces

     

kosmic1

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

10+ Year Member



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?

Thanks,
Cameron

jdMorgan

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

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



kosmic1,

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]

HTH,
Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month