$_GET block by easyengine in pages/posts


#1

Hi, after I upgrade the easyengine I was no longer to get $_GET string parameters inside pages and posts. I have several system that runs inside wordpress pages that stoped to work.

Directly PHP files works without trouble

Maybe a tip how to solve this problem?

Works fine in my Local apache enviroment.

http://domain.site.com/f/?name=andremacola ->not work http://domain.site.com/wp-content/themes/sys/page-f.php?name=asdasd ->works fine

A simple file page-f.php with

<?php
if (isset($_GET["name"])) {
echo $_GET["name"];
}
print_r($_GET);
?>

Best practice for handling query vars
#2

Already posted solution at - https://github.com/rtCamp/easyengine/issues/317


#3

Not solve the problem. I I know what I am doing at wordpress. Let migrate this topic to here.

/?page_id=25195&nome=andremacola-> without the rewrite rules works fine (disabled in nginx .conf).

http://domain.site.com/wp-content/themes/sys/page-f.php?name=asdasd -> Is just an example.

Even with the get_query_var is not working


#4

You need to register your variable using - http://codex.wordpress.org/Function_Reference/get_query_var#Custom_Query_Vars

Something like:

function add_query_vars_filter( $vars ){
  $vars[] = "my_name";
  return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );

If you already added a code block like above, try something other than name. e.g. my_name as used above.


#5

Again, I`m not working with WP_Query and even IF.

Just removed the

include common/wpsc.conf;

And put my own location for index.php and now it’s working partially, need to put some more rewrite conf.


#6

You are free to modify easyengine files but it doesn’t interfere with $_GET. Because we use it a lot on our site.

e.g. https://rtcamp.com/subscribe/?newsletter-topic=nginx - query var is used to enable correct subscription check box.


#7

All my clients are in trouble. Maybe if reinstall the nginx easy engine conf files? Any way to do that ?


#8

EasyEngine config files are present at https://github.com/rtCamp/easyengine/tree/master/config/nginx

You may try manual tutorial at - https://rtcamp.com/wordpress-nginx/tutorials/

If you are comfortable with git, just cd /etc/nginx and run git log or git reset --hard to remove your changes. Only if you are comfortable with git.


#9

In wpsc I changed

try_files /app/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php$args;

to

try_files /app/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$query_string;

And now everything works fine


#10

Glad to know that.

Please check if other important plugins are working correctly. $args is needed by some. Although $query_string is similar.


#11

Hm… Can you name at least one plugin that require $args argument?


#12

WooCoommerce. It used to break more than a year ago - https://rtcamp.com/wordpress-nginx/tutorials/single-site/wp-super-cache/#important-note

We don’t use or recommend wp-super-cache anymore. Nginx does better job with fastcgi_cache.


#13

100% of my clientes use wp-super-cache. I’ll test fastcgi_cache but wpsc does the job for me for 5 portals and 30.000 unique visitors each site per/day =). You can close this thread now. Thks for the response.


#14

Fine. You can use whatever works for you. Any cache is better than no cache! :smile:


#15

Hello @andremacola,

I hope your query is resolved. I am closing this support topic for now.

Feel free to create a new support topic if you have any queries further. :slight_smile:


#16