Solved

mod rewrite rule variable placement after ?

Posted on 2013-01-17
2
334 Views
Last Modified: 2013-01-18
I need to know how to write a mod rewrite rule for this example.

This is the original url.
/store.php?sale=first_variable_here&page=second_variable_here

Open in new window


This will be what the new url looks like.
/store/sale/first_variable_here.htm?page=second_variable_here

Open in new window


I tried but it did not work.  
RewriteRule store/sale/(.*)\.htm?page=(.*)\$ store.php?sale=$1&page=$2

Open in new window



Thanks
0
Comment
Question by:Luey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
grahamnonweiler earned 500 total points
ID: 38792600
As the "query string" from the calling url is unaltered, simply append it to your rewrite using QSA directive (query string append).
RewriteRule ^/?store/sale/(.*)\.htm$  /store.php?sale=$1  [QSA,NC,L]

Open in new window

In the above example

www.yourdomain.com/store/sale/first_variable_here.htm?page=second_variable_here 

will rewrite to:

./store.php?sale=first_variable_here&page=second_variable_here
0
 

Author Closing Comment

by:Luey
ID: 38794121
Thanks a ton.  I did some more research on all the things you added to my code and I understand a lot more now. Worked perfect.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 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