Question

I am working with a legacy framework that is using the following rule

RewriteRule ^([^/]*)/([^/]*)\.html$ /router.php?package=$1&page=$2 [L]

and I need to pass existing query parameters to the router.php file as well, for example

http://example.com/bingo1/bingo2.html?param1=foo&param2=bar&param3=baz

Any ideas, or suggestions are greatly appreciated, thank you!

EDIT: Typo in example url

Was it helpful?

Solution

You can use [L,QSA] after your rule (QSA = Query String Append)

RewriteRule ^([^/]*)/([^/]*)\.html$ /router.php?package=$1&page=$2 [L,QSA]

For example, http://example.com/bingo1/bingo2.html?param1=foo&param2=bar&param3=baz will call router.php?package=bingo1&page=bingo2&param1=foo&param2=bar&param3=baz

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top