Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7502
    claush
    Participant

    On my site we use the permalink structure /%category%/%postname%
    without a slash in the end — but for some reason all listings are with a slash in the end?

    How can I make a global change on the site that will enforce the listings to internally link to the non slash version and avoid all those 301 redirects this causes.

    • This topic was modified 8 years, 5 months ago by claush.
    #7505

    Hi,

    I don’t think there is anything in the plugin that forces this. In fact, permalinks is one of the aspects that we leave to wordpress to manage.

    You can consider a change to your htaccess file to force all urls not to remove the trailing slash. There are many articles/posts showing examples of how to do this via a google search
    ___
    BePro Software Team

    #7506
    claush
    Participant

    Confused about why its doing this – as you can see our structure above that should make sure no trailing slash is added.

    Normal posts and other custom posts works fine. But notice both Woocommerce (even if no slash in its permalink stucture) and beprolistings will use the slash in end eg. when using shortcodes to show listings.

    Made fix globally now on the site that will enforce this for both bepro and woocommerce

    added to functions.php in theme:

    function permalink_untrailingslashit($link) {
    return untrailingslashit($link);
    }
    add_filter(‘page_link’, ‘permalink_untrailingslashit’);
    add_filter(‘post_type_link’, ‘permalink_untrailingslashit’);

    #7507

    Hi,

    Thanks for sharing this with the community! Hopefully others running into the same issue will find this post useful

    ___
    BePro Software Team

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.