Solved

mod rewrite rule variable placement after ?

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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