WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
[resolved] redirect old .html links (5 posts)

  1. seedsca
    Member
    Posted 1 year ago #

    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/

  2. jrf
    Member
    Posted 1 year ago #

    Try:

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

    Code: 301 Moved permanently

  3. seedsca
    Member
    Posted 1 year ago #

    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

  4. jrf
    Member
    Posted 1 year ago #

    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.

  5. seedsca
    Member
    Posted 1 year ago #

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

    Thank you

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.