Solved

.htaccess issue - appending parameters

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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