WordPress.org

Ready to get started?Download WordPress

Forums

Nginx rewrite rule for wordpress to remove date and html from the permalink (2 posts)

  1. csstec
    Member
    Posted 11 months ago #

    Looking for a Nginx rewrite rule to remove date and html from the permalink.
    I have few old posts with the following link structure (blogger - migrated recently) http://www.some1wbdom2name.com/2013/08/title.html.
    Currently i am using the wordpress permalink as http://www.some1wbdom2name.com/title.
    I wish to add a 301 redirect from the old url to the new permalink to retain the traffic.
    Please advice me how i can achieve this in the nginx.

  2. Pothi
    Member
    Posted 11 months ago #

    The following may work for you...

    rewrite "^/[\d]{4}/[\d]{2}/(.*).html$" /$1 permanent;

    You may put it at the top of all other rewrite and location directives. I hope that helps.

Reply

You must log in to post.

About this Topic