Any Rewrite flags to aviod/escape spaces

Discuss practical ways rearrange URLs using mod_rewrite.

Any Rewrite flags to aviod/escape spaces

Postby kishor » Tue Jun 10, 2008 6:18 am

Hi

I'm trying to escape spaces from Rewrite rules.
e.g RewriteRule /^HARRISON NEW YORK_mormon_temple\.html$/ /harrison-new-york_mormon_temple [NC,R=301,L]

But this rule not works shows 500 error.

When I escape spaces with \ it's work.

e.g
RewriteRule /^HARRISON\ NEW\ YORK_mormon_temple\.html$/ /harrison-new-york_mormon_temple [NC,R=301,L]

Is any one known any rewrite flag such in other regular expression (/x) to escape spaces or any other way.

Thanks
kishor
 
Posts: 6
Joined: Mon May 05, 2008 5:50 am

Postby richardk » Wed Jun 11, 2008 3:06 pm

Try \s
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^harrison\snew\syork_mormon_temple\.html$ /harrison-new-york_mormon_temple [NC,R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kishor » Thu Jun 12, 2008 1:21 am

thanks richard

Suppose in between two words multiple spaces present then single \s not works.


e.g RewriteRule ^HARRISON NEW YORK_mormon_temple.html$ /harrison-new-york_mormon_temple [NC,R=301,L]
kishor
 
Posts: 6
Joined: Mon May 05, 2008 5:50 am

Postby richardk » Fri Jun 13, 2008 2:21 pm

Try "\s+" instead of just "\s".
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kishor » Mon Jun 16, 2008 5:25 am

thank you
kishor
 
Posts: 6
Joined: Mon May 05, 2008 5:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 46 guests

cron