• Hello,

    I have migrated from DLE (Data Life Engine) to WordPress. one of the guidelines was to keep the same urls as on the old website:
    my permalink config in word press:
    /%post_id%-%postname%.html

    Example of url:
    http://mywebsite.com/1148–.html
    where:
    post_id= ‘1148’
    and
    post_name=’-‘

    but somehow WordPress doesn’t allow ‘-‘ digit in the end and automatically adds ‘2’ as final digit
    so my output from post menu in dashboard looks like this.
    http://mywebsite.com/1148–2.html
    and there is a conflict between MySQL entire and WordPress config, which leads to error page while trying to open the post.

    p.s.

    also i was wondering if there is any chance to automatically set featured image from first url in post_content ?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Yeah, permalink slugs cannot end with a hyphen. It’s not feasible to alter this restriction.

    Are the URLs you want to maintain all in the form ####-.html? The number of digits may vary, but generally an integer followed by -.html? There is validity to maintaining the same URLs, but the advantages can be gained through other means. This could be an opportunity to migrate to more meaningful URLs. Go from example.com/1148-.html to example.com/creating-good-urls/.

    For a limited number of pages, this is feasible by adding a series of redirect rules to .htaccess. By redirecting with 301 status, any accumulated page rank associated with the old URL should eventually transfer to the new page.

    For a huge number of pages you will need a more formulaic solution, custom redirects become too cumbersome. The simplest would be to add an .htaccess redirect rule that strips the -.html portion off so the new URLs are simply like example.com/1234/. Again, redirecting with 301 status will transfer page rank.

    The featured image can be set by code when the page is updated by adding the attachment ID to the post meta key _thumbnail_id. Thus code would need to extract the image URL from page content, then find that URL in post data to determine the related attachment ID.

Viewing 1 replies (of 1 total)

The topic ‘Permalink Post_name’ is closed to new replies.