logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: re-writing using QUERY_STRING issue
Author
tripcode



Joined: 05 Feb 2006
Posts: 10

PostPosted: Fri 03 Nov '06 14:09    Post subject: re-writing using QUERY_STRING issue Reply with quote

Hi

I'm trying to grab a came from URL in the form of a QUERY_STRING and then append that to a login URL so that a user is returned to the page that they logged in from. The re-write rule below does work but when I put in the RewriteCond above it it doensn't work and I don't even get the https. Would there be something wrong with the syntax here?

Thanks


RewriteCond %{QUERY_STRING} came_from=http(.*)

RewriteRule ^/(.*)login_form$ https://www.yoursite.com/$1login_form?came_from=https%1 [NE,L]
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Fri 03 Nov '06 21:07    Post subject: Reply with quote

There is a section on this page that may help out:

http://www.crucialp.com/resources/tutorials/server-administration/how-to-howto-mod_rewrite-with-apache.php

A code example from link above:
Code:
RewriteCond %{QUERY_STRING} id=([^&;]*)
RewriteRule ^/$ http://%{SERVER_NAME}/%1/? [R]
RewriteRule ^/([^/]*)/?$ /index.php?id=$1 [L]


This straight forward example shows the use of conditional rewriting of the URL but you need to scroll down a bit. This thread got me to thinking, and I can see some good uses for this.
Back to top
tripcode



Joined: 05 Feb 2006
Posts: 10

PostPosted: Sat 04 Nov '06 13:51    Post subject: Reply with quote

thanks for this. The syntax looks quite a bit different to what I have above. A little more complex. I'll read the article, try it out and get back with what happens.
Back to top


Reply to topic   Topic: re-writing using QUERY_STRING issue View previous topic :: View next topic
Post new topic   Forum Index -> Apache