Query String Variables Exist but $ _GET is empty

I developed a website for the client on my development server and migrated it to the production server. On both sites, the URL is similar to http://www.siteurl.com/blogs/?m=09&y=2012

On the development server, if I var_dump($_GET) , I get the expected values.

On the var_dump($_GET) server, if I var_dump($_GET) , I get an empty array.

I would post phpinfo() if that helps, I don’t even know which settings can cause this.

Thanks.

+4
source share
2 answers

I had the same problem.

See this forum: http://forum.kohanaframework.org/discussion/734/_get-empty/p1

 Solved replacing this: RewriteRule .* index.php/$0 [PT,L] for this: RewriteRule .* index.php?$0 [PT,L] 

Add a new rule to .htaccess. He will work

 RewriteRule ^[A-Za-z]+$ index.php?$1 [QSA,L] 
+5
source

As I said above, you need the QSA flag (read "query string append") to pass the PHP query string:

 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /subdir/ RewriteRule ^index\.php$ - [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /subdir/index.php [L,QSA] </IfModule> 
+2
source

Source: https://habr.com/ru/post/1437652/


All Articles