I've got a handful of files named like "index.php?page=1", "news?id=1". How do i setup apache to transmit exactly these files with queries like "http://site.com/index.php?page=1", "http://site.com/news?id=1" etc. I attempted .htaccess rules

RewriteRule ^(.*)$ $1 [L,QSA]

It doesn't work.

You need to scribe the special figures ? and = within the URL that's employed for the request.


For instance, in case your file is known as strange.php?plop=1, then, your URL should be :

http://tests/temp/strange.php%3Fplop%3D1

In PHP, you can do this while using [cde] function.



Edit following the comment : within this situation (that is not really good... ), an answer may be to utilize a rewrite rule like that one :

urlencode()

This can redirect everything to RewriteRule .* temp.php .

There, you may have the ability to use something in [cde], to locate that which was the request.


For instance, basically refer to this as URL :

temp.php

And employ this part of code during my $_SERVER :

http://tests/temp/strange.php?plop=1

I recieve this output :

temp.php

So, here, I suppose I possibly could re-build the file-title, using var_dump($_SERVER); .