In a Wordpress/Buddypress installation, I am having to go through all my
code and manually insert ampersands. For example, where there are links
to things such as “?r=user” I am having to convert that into “?&r=user”
in order for the link to do the required function. Or when it says
“?_wpnonce” I am needing to change it to “?&_wpnonce”.
Am I missing something? Is there an easy rewrite rule I can use for
Nginx to fix this?
I am on Nginx only, not using it as a proxy to Apache.
In a Wordpress/Buddypress installation, I am having to go through all my
code and manually insert ampersands. For example, where there are links
to things such as “?r=user” I am having to convert that into “?&r=user”
in order for the link to do the required function. Or when it says
“?_wpnonce” I am needing to change it to “?&_wpnonce”.
Why would you need to do this?
& and ? don’t go next to each other. ? indicates the start of query
arguments and & separates them.
In my vhost file I had to add client_max_body_size 60M, and in
nginx.conf I configured gzip but otherwise everything’s about the same
setup. I’m on nginx 0.8.54.
What I’m saying is that my links don’t work correctly unless I do that.
I have no idea why. For example, when I could click a link that would
take me to something/some?_wpnonce1234 it would take me to an error page
that said “are you sure you want to do this?” but when I added the
ampersand, it worked as designed. so something/some?&_wpnonce1234 would
work. So now I’ve gone through my whole site and into the WP and BP core
and added ampersands everywhere and my site is fully functional on
Nginx.
I have Nginx with PHP FPM and the Nginx compatibility plugin for php5. I
set it up on a VPS from scratch following a tutorial and it’s all been
great except for this one issue.
In my vhost file I had to add client_max_body_size 60M, and in
nginx.conf I configured gzip but otherwise everything’s about the same
setup. I’m on nginx 0.8.54.
I think you must have gotten something wrong. I’d start by
double-checking at the vhost config. The “fix” you are doing is not
correct.
Haven’t looked at your conf, but you likely forgot a ? at the end of
the target in your rewrite statement.
Have a look at Module ngx_http_rewrite_module
(especially the part after “To rewrite a URL with parameters to
another URL, use this instead:”).
Thanks for your help, Cliff. I have a feeling that what you say is
spot-on. Perhaps from that tutorial I have added in some kind of
redirect or something that is causing the ? links to not work without an
appended &. It’s really weird. Maybe I should try replacing the & with
another ?. If I’m removing the first ? by default, that would make sense
then. Although, I have checked the site across many browsers now, and
everything is working exactly how it should. Load times are extremely
fast. Before, I got lots of error messages. So while this fix isn’t
necessarily correct, it seems to be working, and as I’ve repeated it
across different links, they all start to work. So I’m going to roll
with it for now…I’m on a time crunch to get this up. I’ll have to look
more into it later.
Until then, if you or anyone thinks of anything, please make a shout
Jon
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.