Yoast SEO
[Plugin: WordPress SEO by Yoast] when using custom permalinks with .html, the / is still enforced (1 post)

  1. Jonathan Dingman
    Posted 4 years ago #

    so I have a registered CPT with a custom permalink structure using .html at the end.

    function person_rewrite_rules() {
    global $wp_rewrite;

    $cpt_person_structure = "about/%person%.html";

    $wp_rewrite->add_rewrite_tag( '%person%', '([^/]+)', 'person=' );
    $wp_rewrite->add_permastruct( 'person', $cpt_person_structure, array( 'paged' => false, 'walk_dirs' => false ) );

    I want the / being enforced for my other taxonomies that don't use .html, but when I check the "enforce trailing slash" -- it also adds it to the .html permalinks.

    ie it would show up as domain.com/about/joost.html/ -- instead of just joost.html

    When displaying the links, it shows them as /about/joost.html/ -- but when I actually go to the page, it drops the trailing slash.

    It's likely very bad for SEO to be linking to the wrong URL, if it's just going to correct itself before getting to the final page.

    Any thoughts?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic