• I’m trying to build a new WordPress site to replace my existing Google Sites site (which replaced an old Drupal site.) Up to this point I’ve been able to bring the URLs along (setting the permalinks to use a custom structure of /node/postname_here/)

    This works fine for alphanumeric permalinks, such as
    my.site.com/node/my-awesome-post

    However, the old posts that I want to bring along, which were originally on Drupal, have permalinks in the format of
    my.site.com/node/5/

    When I click one of those links, the browser does a 301 redirect to
    my.site.com/node/

    Is there any way that I can get the old all-numeric permalinks to work?

Viewing 5 replies - 1 through 5 (of 5 total)
  • A slug in WordPress should never contain a slash /
    Just a number might mess things up, since they may be seen as Post ID, but would most probably change after import.
    I’d try to replace that slash with a hyphen -
    If your server uses Apache, then you could add a custom rewrite rule in .htaccess to replace /node/ with /node-, if needed.

    Thread Starter smily03

    (@smily03)

    I guess I’m confused…my “slugs” are just numbers (2, 12, 15, etc. – that’s all that I’ve typed in the “URL Slug” box is just a number.)

    The “permalink settings” page has lots of slashes in the choices –
    Day and Name – https://my.site.com/2020/11/14/sample-post/
    Month and name – https://my.site.com/2020/11/sample-post/
    Numeric – https://my.site.com/archives/123
    Post name – https://my.site.com/sample-post/

    This is the one I’m using –
    Custom structure – https://my.site.com/node/%postname%

    Those are settings for how WordPress is going to generate (and understand) URL’s.
    the slug in this case is %postname% (which in the samples is represented as sample-post.
    And as you can see, there may be formats where just digits will be regarded as archive addresses. Let’s say you’ve got a node with number 2019. Should WordPress show a yearly archive, or just the node 2019 if a visitor requests /2019/ ?

    Thread Starter smily03

    (@smily03)

    Since I’m not using “day and name,” “month and name,” or “numeric”, I guess I would expect that “post name” should work correctly since those posts are named “3” (etc.)

    For my part, I’m just trying to get it to work. Is there any way to name one post “3” and another “sample-post”?

    I just tried a bit on my test-blog. The currently assigned post ID is somewhere between 600 and 700. So I name new page, say, 2078. According to my slug structure it ought to have been given the slug /2078. But since just numbers are reserved slugs, WordPress automatically changed the slug to /2078-2.

    So yes, in order to get this to work, you’ll have to somehow change the post names to include something more than just digits. Previously, I suggested that you prefix them. WordPress itself adds a suffix, as you see here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Numeric slugs’ is closed to new replies.