Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

allowing additional querys to pass at the end of a rewrite

Posted on 2007-10-15
3
Medium Priority
?
184 Views
Last Modified: 2010-03-04
First, the rewrite rule I am using, that works, is as follows:

eg: www.website.com/Primary/Subpage.html
RewriteEngine On
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+).html$ /page.php?D=$1&DP=$2&Account=Client

This creates www.website.com/page.php?D=Primary&DP=Subpage&Account=Client

Occasionally, there is an additional string, eg
www.website.com/Primary/Secondary.html?addition_1=blabla
www.website.com/Primary/Secondary.html?foo=blabla
www.website.com/Primary/Secondary.html?thisone=blabla&thatone=blabla

I have tried:
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+).html?(.*)$ /page.php?D=$1&DP=$2&Account=Client&AdditionalString=$3
(... figuring I could break it up with explode.)
and
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+).html?(.*)$ /page.php?D=$1&DP=$2&Account=Client&$3

This does not pass anything through, not AdditionalString, addition, foo, thisone, thatone.

Is there a rewrite that will allow "whatever" the query is after to be captured as a whole?

eg rewrite to: www.website.com/page.php?D=Primary&DP=Secondary&thisone=blabla&thatone=blabla... would be perfect

Thanks
0
Comment
Question by:amakaram
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
karlwilbur earned 2000 total points
ID: 20082671
%{QUERY_STRING}

RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+).html?(.*)$ /page.php?D=$1&DP=$2&Account=Client&%{QUERY_STRING}
0
 

Author Comment

by:amakaram
ID: 20083095
Excellent!
Thanks!
0
 
LVL 6

Expert Comment

by:karlwilbur
ID: 20083097
Glad to help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question