Forum Moderators: phranque

Message Too Old, No Replies

Yet another mod_rewrite problem

Passing GET param to a script

         

iProgram

6:20 am on Mar 29, 2005 (gmt 0)

10+ Year Member



Here is my .htaccess:

RewriteRule ^([0-9]+)-([0-9]+).html$ /test.php?id1=$1&id2=$2 [L]

Inside test.php

<?
echo "ID1=";
echo $_GET['id1'];
echo "<br>ID2=";
echo $_GET['id2'];
echo "<br>Name=";
echo $_GET['name'];
?>

Output of "/1-2.html?name=Tom":

ID1=1
ID2=2
Name=

Why it does not echo Name=Tom? How to fix this problem?

iProgram

6:48 am on Mar 29, 2005 (gmt 0)

10+ Year Member



I found [httpd.apache.org] that I do not feel headac when reading the mod_rewrite doc:)

'qsappend¦QSA' (query string append)
This flag forces the rewriting engine to append a query string part in the substitution string to the existing one instead of replacing it. Use this when you want to add more data to the query string via a rewrite rule.

jdMorgan

6:57 am on Mar 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good find! :)

Jim