Redirecting based on site being accessed

A forum for general discussion of the Python programming language.

Redirecting based on site being accessed

Postby jstuckhardt » Thu Apr 04, 2013 7:43 pm

Currently one of our servers is hosting a single site in Apache and I would like to host an additional site in Apache. The problem is that the way Apache is currently configured (httpd.conf calls a python function) is that a user must already be logged to our portal (which is the site I want to move to Apache) or Apache is configured to redirect them to the login form. (See below)

Code: Select all
def unauthorized(req):   
    util.redirect(req, _login_form)


Is there a way to check what site the user is trying to access and redirect them based on the site they are accessing in the function above? I'm open to suggestions. I have been trying to figure this out for a couple days, please help!
jstuckhardt
 
Posts: 4
Joined: Wed Apr 03, 2013 6:43 pm

Re: Redirecting based on site being accessed

Postby setrofim » Sun Apr 07, 2013 5:43 pm

You need to give more details about exactly how you're implementing the web app (e.g. which framework you are using); but you should be able to get the URL from the request object that gets passed as the argument to the function.
setrofim
 
Posts: 288
Joined: Mon Mar 04, 2013 7:52 pm


Return to General Discussions

Who is online

Users browsing this forum: Marbelous and 3 guests