bvarvel
1
I have a page that is redirected - let’s say for the sake of argument that it’s the following:
www.website.com/yellow
Which, through the magic of htaccess, behind the scenes shows www.website.com/showcolor.php?id=yellow
Now, say I wanted to pass an additional variable, like a code?
www.website.com/yellow?code=123
Is this possible? And if so… how do I do it?
and just so you know - there is no trailing .php in url.
ronalds
2
If your rewrite rules have QSA then it should work fine.
bvarvel
4
OK - an add on to this. I’ve currently got htaccess configured as so:
RewriteRule ^properties/([0-9]+) properties/showprop.php?id=$1 [QSA]
But now when I try add UTM variables in email newsletters, it serves up broken pages. Any thoughts on how to make it all coexist peacefully?
Does anyone know how to make mod_rewrite rules and UTM tracking codes coexist peacefully?
xMog
6
Hello bvarvel!
I tried your use case. I have this .htaccess at the root of my site:
RewriteEngine on
RewriteRule ^properties/([0-9]+) properties/showprop.php?id=$1 [QSA]
And I created the page “/properties/showprop.php”
In “showprop.php”, I have this code:
<html>
<head>
</head>
<body>
Show prop:
<?
echo "id: " . $_GET["id"] . "<br>";
echo "UTM: " . $_GET["UTM"];
?>
</body>
</html>
When I call the URL http://localhost/properties/11?UTM=10
The page prints out the expected result:
Show prop: id: 11
UTM: 10
So, either I didn’t understand what was your question or there’s something else preventing it from working.