Forums

redirect (3 posts)

  1. ndock
    Member
    Posted 1 year ago #

    How to redirect /%postname%.html to /%year%/%postname% ?.

  2. Redirecting the post name is easy. The year... not so much. You have to know what the year is... Example: in your .htaccess:

    RedirectMatch 301 (.*)\.html$ http://www.example.com/2010/$1/

    See how I had to hard code 2010? If that's not something 'gettable' from the URL, it can't be parsed :/

  3. ndock
    Member
    Posted 1 year ago #

    ipstenu ...

    I quite understand if it is assumed, we started writing in 2010, then we changed the permalink structure in the same year (2010).
    In the cases I mean, we started writing in 2008 and changed the permalink structure in 2010. And than we need to redirect all posts with htaccess.
    Is it still possible to use these RedirectPermanent? as i knew that redirection syntax is

    RedirectPermanent URL_path new_absolute_URL

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags