WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. csstec
    Member
    Posted 1 year 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 1 year 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
    Member
    Posted 2 weeks 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:

    http://websitename/2014-07-30/gardening/bestflowerseeds/10

    Would display to the users as:

    http://websitename/gardening/bestflowerseeds.

    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