Wordpress Permalink Change - Rewrite Wanted

Ross ross at thegodlikehobo.org
Tue Jan 12 01:41:40 MSK 2010

On Mon, Jan 11, 2010 at 3:13 PM, Philip Churchill
<philip at churchilluk.co.uk> wrote:
> I have changed my Wordpress permalink structure from:
> /%year%/%monthnum%/%day%/%postname%/
> TO
> /%postname%/
> But i'm not sure what to put in my nginx config file for the old links to be
> re-directed to the new ones. I would also like any www requests to go to
> http only also
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

The following will make Wordpress permalinks work properly, assuming
it is installed in the webroot.

location / {
try_files $uri $uri/ /index.php?q=$uri;

And if you're concerned about SEO, checkout the nginx-compatibility
plugin. When the old permalinks are accessed, it'll cause Wordpress to
redirect to the new ones with a 301 (moved permanently) instead of the
less SEO-friendly 302 (found).

As for removing the www, you could use something like:

server {
listen   80;
server_name  www.domain.tld;
rewrite ^/(.*) http://domain.tld/$1 permanent;


More information about the nginx mailing list