Reputation: 505
I'm running Django, and I have a php script that I want to serve at /books, which is at the location /ci/home/bookSearch, but I want it alias'ed at books, is this possible with django? I tried using mod_rewrite, but I get the django url not found error when I try to do it.
Is it possible with static files?
Thanks!
Upvotes: 1
Views: 1113
Reputation: 2640
You don't need to use mod_rewrite for this if you're using mod_wsgi. Just create an Alias before your WSGIScript directive and it will work like normal.
Alias /books /ci/home/bookSearch
WSGIScriptAlias ...
Upvotes: 2
Reputation: 3332
If you want an entire set of URLs served by Django, and then another URL within those that is instead handled by a custom PHP script, then that's something you would set up in your web server, such as Apache or nginx. Then the URLs /urla /urlb and /urlc would be handled by Django, and /books would be via PHP.
What you might consider instead is a HTTP redirect from /books to /ci/home/bookSearch. That way you can have the user type /books into the URL bar and arrive at the correct location, even if it's the second, longer URL.
This HTTP redirect in Django would be as follows:
# urls.py
...
url(r'^books$', 'django.views.generic.simple.redirect_to',
{'url': '/ci/home/bookSearch'}),
...
Upvotes: 1