You do not have to do anything. Apache is supposed to set a request header with a name SCRIPT_NAMEthat is your base URL, and all URL callbacks take this into account.
How do you create these urls in your templates?
Refresh
So your problem is getting Flatpages URLs. The problem is that the usual way to calculate URLs dynamically so that they are taken into account SCRIPT_NAMEusing a function reverse()or tag {% url %}does not work with Flatpages, because they are not sent via .py URLs, but through special middleware that runs on 404 .
urls.py flatpages. flatpagemiddleware settings.py, urls.py :
url(r'^(?P<url>.*)$', 'django.contrib.flatpages.views.flatpage', name='flatpage'),
:
<a href="{% url flatpage page.url %}">
.