• Hello,

    I don’t know why but my permalink move :
    /%category%/%postname%/

    to

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

    and I have many many 404 in Google webmaster tools…

    I know it’s possible to have RedirectMatch 301…but i don’t know how

    this link https://yoast.com/wp-content/permalink-helper.php help me…but not with /%year%/%monthnum%/%day%/%postname%/

    Can someone help me ?

    Thanks

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You will not be able to redirect to an URL containing date data by using .htaccess redirects. .htaccess can only use data contained in the original request in addition to static data to build a redirect. It cannot look up date data.

    You do not really need date data, the postname alone will suffice to retrieve the post. I’m not very good with regexp, but I think this will work at least in part.
    RedirectMatch 301 ^/.*/(.*)$ http://example.com/$1

    This will rewrite /%category%/%postname% to /%postname%
    The problem is other URLs besides the /%category%/%postname% format will probably be corrupted. You may need a rewrite block in order to only rewrite /%category%/%postname% URLs and pass others through unchanged.

    You say

    I don’t know why but my permalink move

    So you did not wish this change to occur? Why not restore it to what you want instead of rewriting to the new format that you do not want?

Viewing 1 replies (of 1 total)
  • The topic ‘Help with WordPress Permalink 301 Redirect via .htaccess’ is closed to new replies.