nginx + wordpress rewrite question

Ray gunblad3 at gmail.com
Tue Feb 9 10:06:13 MSK 2010


Not sure whether this would help, but WP usually is able to handle
"rewriting" by itself.

I only need this config to get WP to work:

location /
 {
 if (!-e $request_filename) {
 rewrite ^.*$ /index.php last;
 }
 }

location ~ \.php$
 {
 fastcgi_pass (your php socket/port here);
 }

And WP has to be configured correctly in Settings > Permalinks (like what
Hone Watson said).

Ray.

On Tue, Feb 9, 2010 at 8:09 AM, Jaime Magiera <jaime at sensoryresearch.net>wrote:

> Hello,
>
> This is a really basic question. I'm unfamiliar with nginx (didn't even
> know it existed until a couple days ago) and not a master at URL rewrites. I
> have been tasked with hooking up Wordpress to nginx. The basic setup was
> easy enough. However, I'm running into some problems with the rewrites. I've
> been asked to rewrite from the static permalink format...
>
> "/blog/$postname$-$post_id$"   (e.g. /blog/my_blog_post_title-49) => to the
> standard "/blog/?p=N"
>
> I've tried a bunch of variations, but I keep getting it wrong because the
> non-post content (css, images, etc.) are returning 404s. Does anyone have an
> example of how to do a nginx rewrite that does the above?
>
> thanks for any suggestions,
>
> Jaime Magiera
>
> Sensory Research, Inc.
> http://www.sensoryresearch.net
>
>
>
>
>
>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100209/d8ecb28e/attachment.html>


More information about the nginx mailing list