Support » Plugin: Redirection » redirect old .html links

  • Resolved seedsca

    (@seedsca)


    I used to host my blog with blogger and have switched to wordpress. The link structure is identical except the old posts end with /post.html and the new ones end with /post/

    Any help on writing a regular expression to redirect all these at once?

    Thanks and great work

    http://wordpress.org/extend/plugins/redirection/

Viewing 4 replies - 1 through 4 (of 4 total)
  • jrf

    (@jrf)

    Try:

    Source url: ^/(.+)/post\.html$
    Regex: ticked
    Target: /$1/post/

    Code: 301 Moved permanently

    seedsca

    (@seedsca)

    Thanks for the reply. What I meant is that I had my blog set up as:
    http://domain.com/year/day/post-name.html
    and now it’s
    http://domain.com/year/day/post-name/

    These are just examples and the word post is not really used. How would I remove the “.html” and replace it with a “/”?

    Thanks again

    jrf

    (@jrf)

    Seedsca: did you even bother to try the solution I gave you ? It *will* do what you need it to do based on the information you provided…

    Anyways, if you want to make it more specific and postname is a variable as well, try:

    Source url: ^/([0-9]{4})/([0-9]+)/(.+)\.html$
    Regex: ticked
    Target: /$1/$2/$3/
    Code: 301 Moved permanently

    If you know the allowed characters for the post-name part of the url, you can even make that bit more specific, something like [a-z0-9-]+ for instance.

    seedsca

    (@seedsca)

    @jrf: I did try it without success. The second option worked like a charm however.

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘redirect old .html links’ is closed to new replies.