Wordpress Permalink Change - Rewrite Wanted

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

On Mon, Jan 11, 2010 at 3:13 PM, Philip Churchill
[email protected] wrote:

http only also


nginx mailing list
[email protected]
nginx Info Page

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;
}

-Ross

On Mon, Jan 11, 2010 at 12:13 PM, Philip Churchill
[email protected] 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.

Nginx side, but would recommend the wordpress plugin instead!

location ~ ^/(.)/(.)/(.)/(.)/$ {
rewrite ^ /$4 permanent;
}

On Mon, Jan 11, 2010 at 2:41 PM, Ross [email protected] wrote:

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

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

Please check out WordPress | NGINX for more strategies.

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

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

A better rewrite is:
rewrite ^ http://domain.tld$request_uri permanent;

– Merlin