• I’m a convert from MoveableType, and I’d like to preserve the permalink naming convention that I had from my MT installation. How can I cause WordPress to make permalink URLs that look like this?

    https://www.theatlasphere.com/metablog/000352.php

    It looks like WordPress has a lot of built-in functionality in this regard, so I thought I’d see if it can be done within WP before I go try and fumble through learning how to write the htaccess code myself!

Viewing 14 replies - 1 through 14 (of 14 total)
  • did you try the following permalink structure?

    %post_id%.php

    Good one Denis, that will work, except it won’t be zero-filled, so it will be like this instead:

    https://www.theatlasphere.com/metablog/352.php

    Is that ok? If not, I think you’ll have to hack the code to achieve zero-padding in permalinks.

    Thread Starter jzader

    (@jzader)

    UH-OH. I was playing around with these suggestions, and now whenever I try to go to the blog, I get an error in FireFox: “redirection limit exceeded”.

    And I get the same error within the WordPress admin console, which means I can’t make any further changes from within WordPress.

    I’ve tried removing the relevant code from htaccess, and that doesn’t help.

    HALP?!? ?? Seriously, this is obviously a major problem. Any expeditious suggestions would be gratefully appreciated.

    Thread Starter jzader

    (@jzader)

    OK, solved my crisis. ??

    The “zero problem” is resolved by editing the template-functions-links.php file (wp-includes\ directory). Under the get_permalink() function look for the $rewritereplace array, and in it change:

    $post->ID,

    to:

    zeroise($post->ID, 6),

    That uses the WP function zeroise() to force the ID to 6 places by inserting zeros at left when it’s less than 6 digits.

    When modifying source files, back up any you are editing, and comment your changes for future reference.

    Well done Kafkaesqui, I obviously haven’t spent as much time in the code as you have!

    Believe me, I’ve spent far TOO much time in it! :/

    Thread Starter jzader

    (@jzader)

    I haven’t gotten to the part yet about fixing the zeroes. But I’m already getting 404 errors.

    Here’s what I’m doing… When I update my permalink structure in options-permalink.php to %post_id%.php, and then update my .htaccess file with the provided code, then return to the main page of my blog, reload, and click on a link to an individual entry … I get a 404 error.

    I have the same problem if I use %post_id% without the .php part.

    What would cause this?

    Does your server support mod_rewrite?

    update my .htaccess file with the provided code

    Huh? Why do you need to do this? WordPress updates the .htaccess for you.

    And, you will need an web server enviroment that supports “mod rewrite”.

    Thread Starter jzader

    (@jzader)

    My server does support mod_rewrite and I use it successfully.

    Why do I update my .htaccess file manually? Because I have my .htaccess set so that it is not writeable. I want to make sure that WordPress doesn’t muck up any of my custom redirects, etc.

    I just never cared to find out what happens when it edits the .htaccess by itself. So I copy the code that it provides, and paste it into the end of my .htaccess.

    For the record, I did try removing all of my code from the .htaccess, to make sure that it wasn’t any of my prior code that was causing the problem. It had no effect.

    Thread Starter jzader

    (@jzader)

    OK, just to reiterate…. I’m still having a problem with getting 404 errors when I try to use WordPress’s URL rewrite functionality. Any ideas about what’s causing it?

    Thread Starter jzader

    (@jzader)

    Follow up…. I was able to fix the 404 problem by letting WP write its own htaccess files.

    I have no special settings on .htaccess and do have mod_rewrite in place. Yet when I make the permalink option /%post_id%/, or /%post_id%, I get a 404 on clicking any permalink.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Rewriting ?p=352 to 000352.php’ is closed to new replies.