Solved

.htaccess issue - appending parameters

Posted on 2014-09-04
1
186 Views
Last Modified: 2014-09-13
I've been trying to figure a way of rewriting a url to direct anything *.php to index.php, which Ive managed to do by using:-
RewriteEngine on
RewriteRule ^(.+)/(.+).php index.php?section=$1&file=$2 [nc]
RewriteRule ^(.+).php index.php?file=$1 [nc]

Open in new window

which by navingating to test3.php redirects to index.php?file=test3 and /sub/test3.php navigates to index.php?section=/sub/&file=test3

However what I want to do is append the parameters passed to the page, so for example navigating to test3.php?param=27 redirects to index.php?file=test3&param=27 , so what Ive done is the following:-
RewriteEngine on
RewriteRule ^(.+)/(.+).php?(.+) index.php?section=$1&file=$2&$3 [nc]
RewriteRule ^(.+).php?(.+) index.php?file=$1&$2 [nc]

Open in new window

But it doesnt seem to append the parameters correctly, and I cannot figure out where Im going wrong.

Anyone know of a possible solution?

Thank you
0
Comment
Question by:tonelm54
1 Comment
 
LVL 5

Accepted Solution

by:
Jan Louwerens earned 500 total points
ID: 40304776
Try adding the query string append flag to the rewrite rule: [QSA]
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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.
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…

773 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