Solved

.htaccess issue - appending parameters

Posted on 2014-09-04
1
191 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
[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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
What You Need to Know when Searching for a Webhost Provider
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

763 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