- This topic has 3 replies, 2 voices, and was last updated 9 years, 5 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Tagged: permalink, trailing slash, URL
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.
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
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’);
Hi,
Thanks for sharing this with the community! Hopefully others running into the same issue will find this post useful
___
BePro Software Team
Stay up to date on web design and development trends. Also receive updates on video tutorials, services, deals, products, and discounts offered by the BePro Software Team. to sign-up for our newsletter today.