I've got hundred of webpages already created with RewriteRules and PHP
foo.com/section/item/number --> foo.com/section.php?item=number
foo.com/story/number ---> foo.com/story.php?id=number
Now I would like to include an extra parameter for all the webpages
foo.com/section/item/1?param=yes
foo.com/story/34?param=yes
I tried with:
if (isset($_REQUEST['param']))
{
print "IT WORKS!";
}
It works only with 'foo.com' (the 'index.php') with no RewriteRule.
I tried also by adding QSA to the RewriteRule
RewriteRule ^story/([^/]+) /story.php?id=$1 [L, QSA]
What am I doing wrong? Thank you very much.
I'm not able to test, but I think this will do what you need
RewriteCond %{QUERY_STRING !¶m=yes
RewriteRule ^/?c/(.*)$ /%1?%{QUERY_STRING}&¶m=yes [L]
First this makes sure if a request already has param=yes in it, do nothing, otherwise append either ?param=yes or ¶m=yes , if the request already has ? in it.