.htaccess permalink rewrite help

Discussion in 'Apache' started by jtprattmedia, Feb 28, 2011.

  1. #1
    I need some help with an .htaccess rewrite.

    I have a site that had this permalink: /archive/%post_id

    and changed it to this: /%postname%/

    I have tried every single permalink redirect and change plugin - none of them work for this scenario.

    The site has 15,000 posts, adding one line 301 redirects in the .htaccess file isn't going to work.

    Can someone help me add a rewrite that will redirect all instances of /archive/%post_id to /%postname%/ ?

    any help appreciated!
     
    jtprattmedia, Feb 28, 2011 IP
  2. MartinPrestovic

    MartinPrestovic Peon

    Messages:
    213
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There is no way to do this with .htaccess other than the one per line method. This is because there is no information in the original permalink which can be used to translate into the new format.

    The best way to do this would be using PHP, when a user visits the page using the old format you can perform a look up of the postname and send a header to 301 redirect the user to the new version. Search engines will also follow this if it is implemented correctly.
     
    MartinPrestovic, Mar 2, 2011 IP