redirect old permalink to new permalink

Discussion in 'Apache' started by mann3r, Jan 18, 2007.

  1. #1
    Previously my permalink structure was /%category%/%postname%/ and their are already post made using that permalink, but then I have changed my permalink structure from above to /%postname%.html how can I redirect those post using the old permalink to the new one. using .htaccess. Because I got 404 pages and bots keeps on requesting the old links.
     
    mann3r, Jan 18, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try...
    RewriteEngine On
    RewriteRule ([^/]+)/(.*) $2.html [R=301]
    Code (markup):
     
    rodney88, Jan 18, 2007 IP
  3. mann3r

    mann3r Peon

    Messages:
    1,416
    Likes Received:
    100
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, I will try it out
     
    mann3r, Jan 18, 2007 IP
  4. mann3r

    mann3r Peon

    Messages:
    1,416
    Likes Received:
    100
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i have tried the code but i got problems since i have a folder in the host which is not part of wordpress thus all folder will be redirected also to http://www.yourdomain.com/.html so it is not working
     
    mann3r, Jan 29, 2007 IP
  5. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #5
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !-d
    RewriteCond %{REQUEST_URI} !-f
    RewriteRule ([^/]+)/(.+) $2.html [R=301]
    Code (markup):
    Checks if the requested file/dir exists and only redirects if it doesn't.
     
    rodney88, Jan 31, 2007 IP