Reputation: 1037
I allow users to submit a query at mysite.com/go/QUERY\
If the query contains "/" Apache chokes.
From urls.py:
(r'^go/(?P<querytext>.*)$', 'mysite.engine.views.go'),
Try:
http://mysite.com/go/http%3A%2F%2F
Result:
Not Found
The requested URL /go/http:// was not found on this server.
Apache/2.2.12 (Ubuntu) Server at ...
BUT, if I enter the non URL quoted values it works:
http://mysite.com/go/http://
WORKS just fine...
Any ideas?
Upvotes: 2
Views: 785
Reputation: 24823
Your httpd is blocking encoded slashes.
try adding AllowEncodedSlashes On
to your apache config to enable encoded slashes in apache (docs)
Upvotes: 3
Reputation: 33726
Looks like you might need to decode the URL before you pass it along. You can do this with urllib.unquote
.
>>> import urllib
>>> urllib.unquote("""http%3A%2F%2F""")
'http://'
Upvotes: 0
Reputation: 883
From the Django docs it looks like you're only supposed to use the (?P....)
notation when implementing a named group (http://docs.djangoproject.com/en/1.1/topics/http/urls/#named-groups).
Try fixing your regex by either getting rid of the ?P
or completing the syntax and naming the group like (?P<search-term>.*)
Upvotes: 2