0815

Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Change Permalinks from Date-Based to Post-Date Only

Here is an HTAccess method for switching your permalinks from the lengthy date-based format (i.e., http://domain.tld/2009/03/03/post-name/) to the concise post-name format (i.e., http://domain.tld/post-name/).

To do so, first login to the WordPress Admin and switch your permalink structure from this:

/%year%/%monthnum%/%day%/%postname%/

..to this:

/%postname%/

This change will ensure that all future posts are located at the new post-name-only URL, but we still need to redirect all requests for existing posts via the old date-based URL format. This is easily accomplished with a single directive in your site’s root HTAccess file:

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://domain.tld/$4

And that’s all there is to it! Remember to test vigorously to convince yourself that everything is working properly.

Source: Perishable Press




0