Facing issue with nginx url rewrite rules. What I want is to serve http://example.com/2015/03/23/post-title/ page when someone tries to access http://example.com/2015/03/23/myfeed/post-title/ url. And it should return 200 status. I tried below rewrite rule which works fine when wordpress permalink is set to default but as soon as I set permalink to custom below rules does not works.

location ~ ^(.*)/myfeed(.*) {
      rewrite ^(.*)/myfeed(.*)$ $1$2 last;

Other rule in my nginx conf file is,

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

I guess my rule is conflicting with the WordPress custom permalink rule. Can anyone please help with this?

1 Answer 1


Use this plugin in wordpress and write rule which will overwrite nginx rule.


When you have wordpress, you have to set permalink to default to work your webserver rule work and if you dont want to do that you have to install above plugin and write rule.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.