Solved

mod rewrite rule variable placement after ?

Posted on 2013-01-17
2
330 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
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Xampp Not Stopping 9 40
Problem with .htaccess file 4 66
Apache 2.2 on Windows 2008 32 69
PHP_POST() error message 9 44
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now