Welcome! Log In Create A New Profile

Advanced

Wordpress: Permalinks with GET requests

Posted by miradev 
Wordpress: Permalinks with GET requests
June 29, 2009 11:33AM
I can't find the syntax for passing on the query_string parameters in the permlinks.

Wordpress permalink setting: [code]
/%postname%
[/code]

Nginx config:
[code]
location / {
root /home/httpd/wordpress/CLIENT/domains/DOMAIN/html;
index index.php index.html index.htm;

# this serves static files that exist without running other rewrite tests
if (-f $request_filename) {
expires 30d;
break;
}

# Looks for maint file, otherwise passes missed hits onto php/wordpress.
try_files /system/maintenance.html $uri $uri/ /index.php?q=$uri;
}

location ~ \.php$ {
fastcgi_pass localhost:57093; # port where FastCGI processes were spawned
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/httpd/wordpress/CLIENT/domains/DOMAUN/html$fastcgi_script_name;

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
[/code]

The aim being to get this to work:
http://www.DOMAIN.com/nice/page?myvar=12

Current the QUERY_STRING is [code]q=nice/page[/code] to pass onto index.php

I would like it to be [code]q=nice/page&myvar=12[/code]
Many thanks.
Re: Wordpress: Permalinks with GET requests
June 29, 2009 02:53PM
What rewrites have you tried?

--
Jim Ohlstein
Re: Wordpress: Permalinks with GET requests
June 30, 2009 03:40AM
There are no nginx rewrites.

Do I need to do something with $args ?
Re: Wordpress: Permalinks with GET requests
June 30, 2009 09:33AM
Is it as simple as doing this:

[code] try_files /system/maintenance.html $uri $uri/ /index.php?q=$uri&$args; [/code]

In which case I have been flummoxed by the simplicity of this beautiful daemon :)

Seems to be working for me.
Re: Wordpress: Permalinks with GET requests
June 30, 2009 09:49AM
miradev Wrote:
-------------------------------------------------------
> Is it as simple as doing this:
>
> try_files /system/maintenance.html $uri $uri/
> /index.php?q=$uri&$args;
>
> In which case I have been flummoxed by the
> simplicity of this beautiful daemon :)
>
> Seems to be working for me.

Good deal. What happens if you request a non-existent page? Does WordPress handle it internally and show an error page? If not, you'll get an error from nginx. From http://wiki.nginx.org/NginxHttpMainModule#try_files :

"The last parameter is the fallback URI and *must* exist, or else an internal error will be raised."

If WordPress handles it that's good, otherwise you might just add /index.php to the end as

[code]
try_files /system/maintenance.html $uri $uri/ /index.php?q=$uri&$args /index.php;
[/code]

I haven't configured a WordPress blog with "try_files". In the past we used rewrites (prior to "try_files" directive being introduced).

--
Jim Ohlstein
Re: Wordpress: Permalinks with GET requests
July 01, 2009 04:49AM
Jim Ohlstein Wrote:
> "The last parameter is the fallback URI and *must*
> exist, or else an internal error will be raised."
>
> If WordPress handles it that's good, otherwise you
> might just add /index.php to the end as
>
>
> try_files /system/maintenance.html $uri $uri/
> /index.php?q=$uri&$args /index.php;
>
>
> I haven't configured a WordPress blog with
> "try_files". In the past we used rewrites (prior
> to "try_files" directive being introduced).


I tried with and without the final /index.php, both with the same result. http://www.domain.com/yaddyadda brought up the wordpress theme, with the header and menus, but a blank content div.

No errors generated, just 404 response in the access log file. So it all looks good. Thanks for the help.

PS: Forum is a little wrap-happy!
Re: Wordpress: Permalinks with GET requests
July 01, 2009 11:34AM
miradev Wrote:

> PS: Forum is a little wrap-happy!

That's by design as our busiest area is the mailing list interface and that type of quoting is necessary for mailing list conventions. This forum software lets you chose one type of quoting for the entire site so that's the way it is.

--
Jim Ohlstein
Re: Wordpress: Permalinks with GET requests
July 01, 2009 01:41PM
i use a wp 404 plugin and it does the job perfect without any changing of the nginx config files

http://adult-links.info/dfgdfgdfgdg


grts,

chris

usefull404 its called the plugin.
Re: Wordpress: Permalinks with GET requests
July 01, 2009 01:44PM
nvm i read it wrong, sorry
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready