You might want to have a look at: http://www.djangoproject.com/documentation/settings/#append-slash
Kind regards, Chris Hoeppner www.pixware.org Miguel Filho escribió: > Hello list, > > I'm deploying my site on webfaction.com using mod_python. URL: > http://interno.homelinux.org > > In webfaction.com, I have my Apache instance with mod_python, > listening on a high port, then the main Apache running on the server, > redirect the requests to my Apache instance. A common setup, AFAIK. > > When I try to access an internal URL, like > http://interno.homelinux.org/links, if there is no / at the end, > Django returns an HTTP 301 header, containing the same path, but with > a / at the end. If I type the URL with the / at the end, Django > returns an HTTP 200. Both using mod_python or the `python manage.py > runserver`. > > The problem is when returning the HTTP 301 headers, Django puts in the > response the host with my high port. > > So if I type: > http://interno.homelinux.org/links <-- returns an HTTP 301, headers at > the end of the message. > > Then I get: > http://interno.homelinux.org:2826/links/ > > Using: > http://interno.homelinux.org/links/ <-- slash added, returns an HTTP 200. > > To avoid this, I tried adjusting the URL mapping to this: > (r'^links(/)?', include('interno.links.urls')) > > Adding the (/)? solves the problem, but only if I run my site using > `python manage.py runserver`. If I use mod_python, this does not work, > and Django returns a 301 anyway. > > I tested with Apache2/mod_python in my machine using Debian Lenny, I > have the same behavior as webfaction.com > > Is there anyway to avoid this? I don't understand why the URL mapping > work with the WSGI server, avoiding the 301 responses, but with > mod_python doesn't. > > For logic reasons, I don't want my users accessing my site with a non > standard port. > > Miguel > > Headers: > > GET /links HTTP/1.1 > > Host: interno.homelinux.org > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) > Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) > > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > > > HTTP/1.x 301 Moved Permanently > > Date: Thu, 12 Jul 2007 17:49:58 GMT > > Server: Apache/2.0.52 (Red Hat) mod_python/3.3.1 Python/2.5 > > Location: http://interno.homelinux.org:2826/links/ <======== > > Content-Type: text/html; charset=iso-8859-1 > > Vary: Accept-Encoding,User-Agent > > Content-Encoding: gzip > > Content-Length: 208 > > > > ---------------------------------------------------------- > > http://interno.homelinux.org/links/ > > > > GET /links/ HTTP/1.1 > > Host: interno.homelinux.org:2826 > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) > Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) > > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > > > > HTTP/1.x 200 OK > > Date: Thu, 12 Jul 2007 17:49:58 GMT > > Server: Apache/2.0.52 (Red Hat) mod_python/3.3.1 Python/2.5 > > Vary: Cookie > > Keep-Alive: timeout=15, max=100 > > Connection: Keep-Alive > > Transfer-Encoding: chunked > > Content-Type: text/html; charset=utf-8 > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---