Forum Moderators: phranque

Message Too Old, No Replies

Escape the percent in ReWriteRule

Escape the percent in ReWriteRule

         

etayluz

4:17 pm on Jun 16, 2007 (gmt 0)

10+ Year Member



Hi Jim,

I saw your post from over two years ago:

# Delete all after percent sign (This does not work)
RewriteRule ^([^%]+)\% http://www.example.com/$1 [R=301,L]
#
# Delete all after percent sign (This works)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^%]+)\%
RewriteRule .* http://www.example.com/%1 [R=301,L]

I have this URL:
http://www.example.com/%D7%97%D7%92%D7%9C%D7%99+%D7%91%D7%95%D7%92.htm

and when this URL is requested, I would like it to:

http://www.example.com/file1.htm

Can you please tell me how to write the ReWriteRule to achieve this?

Thanks in advance,

Etay

[edited by: jdMorgan at 9:30 pm (utc) on June 16, 2007]
[edit reason] example.com [/edit]

jdMorgan

3:12 pm on Jun 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\%D7\%97\%D7\%92\%D7\%9C\%D7\%99\+\%D7\%91\%D7\%95\%D7\%92\.htm\ HTTP/
RewriteRule \.htm$ http://www.example.com/file1.htm [R=301,L]

Jim