views:

35

answers:

2

Hello

Here's my code:

RewriteEngine on
RewriteRule page/(.*) index.php?url=$1 [NC]

When I access page/http://google.com/ = works just fine
When I access page/http%3A%2F%2Fgoogle.com%2F = server reports 404

Martti Laine

+2  A: 

I believe you need the B (escape) flag:

RewriteRule page/(.*) index.php?url=$1 [NC,B]

That will escape the back-reference ($1) before adding it to the replace string.

Matthew Flaschen
It still doesn't work :/ I edited the post a bit.
Martti Laine
A: 

Apache returns a (somewhat non-intuitive) 404 in cases when you have encoded slashes in the request, but do not have AllowEncodedSlashes set to on. To confirm this is the case, check your error log, which likely contains an entry like this:

found %2f (encoded '/') in URI (decoded='/page/http://google.com/'), returning 404

Tim Stone