Solved

.htaccess issue - appending parameters

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

628 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