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

  1. csstec
    Posted 2 years 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 Kalimuthu
    Posted 2 years 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.

  3. DarkflameZM
    Posted 1 year ago #

    I know this topic is 11 months old but it's partly relevant to a desire of mine.

    I wish to hide the numerical information from the display urls / permalinks.

    For example:


    Would display to the users as:


    I've found many redirect plugins but none of them appear to be able to do this.

    I also found Yoasts Redirect page but a) it doesn't seem to work and b) it doesn't appear to include category, just post name, i wish for both.

    Any help and advice would be greatly appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic