Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: how to simpy re-direct a url to another without re-writing? |
|
Author |
|
tripcode
Joined: 05 Feb 2006 Posts: 10
|
Posted: Fri 03 Nov '06 14:03 Post subject: how to simpy re-direct a url to another without re-writing? |
|
|
Hi
This is probably a pretty simple question but I am pretty new to using Apache.
I'm currently using this to re-direct requests for a login_form to https
RewriteRule ^/login_form(.*) https://www.domain.com:442/join_form$1 [NE,L]
It works fine. The problem is that it obviously re-writes all the URLs within that page to https. If someone doesn't join the site and navigates away from that page they are left in https. I'd like https only to kick in once a registration and login has been made.
Therefore is it possible to just re-direct the join_form to an https URL and not have the underlying navigational links re-written as well? I can hardcode the submit link on the registration form to be https.
Thanks a lot |
|
Back to top |
|
Brian
Joined: 21 Oct 2005 Posts: 209 Location: Puyallup, WA USA
|
Posted: Fri 03 Nov '06 15:52 Post subject: |
|
|
Instead of putting the redirect burden on Apache you could put it into your authentication scripting.
I assume the login page is HTTPS?
In any event, you could do this in a couple of ways, use re_write to force non SSL if they are not logged in based on such things as location, directory, and so on.
Or, you could code the redirect into your script, PHP, Perl, what ever. In my view it's best to put the burden of redirection on the scripting engines, rather than the server when possible. |
|
Back to top |
|
tripcode
Joined: 05 Feb 2006 Posts: 10
|
Posted: Fri 03 Nov '06 16:44 Post subject: |
|
|
yes the login and join pages I have are https. I'd rather do a simple re-direct in Apache. I understand what you are saying on the scripting side but I am using Plone and am not a python programmer. Would you know the rule to do a re-direct without re-writing the contained page URLs? Thanks |
|
Back to top |
|
Brian
Joined: 21 Oct 2005 Posts: 209 Location: Puyallup, WA USA
|
Posted: Fri 03 Nov '06 18:58 Post subject: |
|
|
Hi,
You say Plone, I hear jets.
No, I am not a Python guy, but I do now in PHP you would use something like:
Code: | <?php
###############################################
#
# your testing and condition stuff goes here
#
# assume you return the $url for where to
# redirect to for this example
#
###############################################
// remember to kick this out before any content or other headers are sent
header( 'location: ' . $url );
?> |
So essentially if they have not met what ever criteria you set, you can have an include file, which Python does support, and you have it included into the head of each script, as appropriate for your situation.
In the head of each file which needs this include it in the Python equivelant of:
Code: | // I suggest require rather than include
require( 'your/path/redirect.inc.php' ); |
Not being a Python coder and instead using a frame work (or is Plone a CMS) as you stated, I don't know how you can integrate these types of modifications into the framework. But, there has got to be Plone support out there, and that being the case as much as this is the best WAMP forum on earth, you may need to enlist additional support here from Python/Plone guru's and/or advice from Python forums such as Devshed.
I bet there are some with experience here though.
It sounds like you want to redirect based on the status of the login, which would be essentially a session, which would be best handled by the scripting environment in my estimation. |
|
Back to top |
|
tripcode
Joined: 05 Feb 2006 Posts: 10
|
Posted: Fri 03 Nov '06 19:21 Post subject: |
|
|
"You say Plone, I hear jets" ?
Not really a coder at all so need to do this in Apache. Should be simple. I tried the Redirect rule but it didn't work right. Everyone seems to use Rewrite but as I say I don't want the underlying page URLs re-written until registration or login. |
|
Back to top |
|
|
|
|
|
|