Solved

mod rewrite rule variable placement after ?

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

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 As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

14 Experts available now in Live!

Get 1:1 Help Now