Filter category_link so WordPress creates slashed URLs for categories, and redirect_canonical so it accepts those URLs:
add_filter( 'category_link', 'wpse_71666_trailingslash_cat_url' );
add_filter( 'redirect_canonical', 'wpse_71666_trailingslash_cat_url', 20, 2 );
function wpse_71666_trailingslash_cat_url( $url, $request="" )
{
if ( 'category_link' === current_filter() )
return rtrim( $url, "https://wordpress.stackexchange.com/" ) . "https://wordpress.stackexchange.com/";
if ( "$url/" === $request and is_category() )
return $request;
return $url;
}
Related Posts:
- Posts URL structure like site.com/category/the-post-title
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Multiple post categories – single permalink
- Preventing index.php?category_name=something from redirecting
- Rewrite category wordpress
- How to? Redirect /category/sci-fi/ to /category/scifi/?
- Exclude subcategories from the url
- Add “page-a” slug to category link if user visit category link from “page-a”
- Rewrite a category
- How do I get rid of “category” from my URL structure?
- Remove subcategory and category with some rules from permalink
- Custom category URL rewriting
- How do I add a tag slug to a category URL to filter posts?
- Redirect Problems with Archive Page and GET variables
- Include specific category in URL automatically
- A different permalink structure for different categories
- WordPress Category url redirects to subdomain
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Modify / Rewrite single template url structure
- How to get permalinks with category base working with sub-categories
- How to remove the term “category” from category pagination?
- Best Way to Redirect Category to Page and Hide Category
- Filtering categories in the permalink structure
- Rewrite rule page url with category
- Using URL parameters, list posts from category and custom taxonomy
- Custom post types with their own permalink structure
- Optimal way to redirect home page to category archive?
- Redirecting specific category posts to subdomain
- Categories’ hierarchy in URL
- Category and tag with same name
- How to create non-unique sub-category slugs?
- Rewrite category slug
- WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)
- Changing the category permalink structure
- How to display only the parent category in the permalink
- Redirecting category link to first child post
- Server (WordPress) redirects files that are not supposed to (using htaccess)
- Page with the same name of a category
- Plural Category Base Slug On Category Archive Page
- Alias ‘wp-content’ directory to something shorter (framework?)
- Custom Category/Subcategory structure
- One WP install, I need to map a custom domain name to each category
- How to show in search results posts with a particular tag in a particular category?
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- Categories not working – 404 Not found error
- How to set up Author archives with sub category URL
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- How to disable URL rewriting for specific URLs?
- Redirect category to url with /category
- WordPress category page redirects in .htaccess not working
- Why do my categories redirect?
- How to change category and year archive permalinks/rewrite rules?
- Wildcard forward all posts and pages with few exceptions
- Read GET parameters in APACHE Mod Rewrite rules for WordPress categories in Posts
- WP didn’t redirect to canonical category URL
- Add /category/ to an author archive page
- Permalinks: display just one kind of wp category in the posts url
- How to redirect large amount of URLs?
- WordPress URL Rewrite for dynamic and customized URL
- category url structure
- Redirect single article permalink to paginated category page
- Automatically redirect a page to a category that share the same slug
- Hierarchical permalink structure for posts showing categories and sub-categories
- Nicer URL for viewing category of posts?
- Change of category structure will cause two kinds of URLs for one post
- Getting back a permalink from custom url
- What Must to Display the “mysite.com/category” URL?
- How to display post in custom file not in archive file?
- Use blog as base for tags and categories
- Category link redirect to custom template page instead of index.php?
- Redirect depending on category chosen
- How to Force WWW. in Domain With WordPress MU Domain Mapping Plugin?
- Custom url structure – pages under a custom post type
- Category URL Management
- WooCommerce Product category can be shown with multiple related URLs
- remove url from categories
- Using custom structure prefix showing 404 for sub-categories
- Add custom categories and subcategories and posts as custom pages
- OK to redirect the root WordPress category slug?
- How to set the same base url for two different taxonomies?
- i want to change URL of WordPress image or rewrite in runtime
- How to remove parent category from child category url using wordpress rewrite rule?
- Category page 404s on mobile but not desktop?
- Category URL’s 404 after setting category base to ‘.’
- How to add a ‘News’ section to specific posts in WordPress
- Default URL for category dropdown select option
- Post url rewriting for posts with certain category
- Any way to make Apache’s internal redirect work?
- Hide category name in URL
- taxonomy term in URL slug won’t forward to the correct term for custom post like it does for default categories/normal posts
- Create monthly archive for parent category
- How to create short urls for sharing and downloadable content?
- Page redirecting to category (IE only)
- What approach should I take for this URL structure?
- How can I get rid of the the category suffix–NOT “prefix” (i.e. foo-1, foo-2, etc)
- Multiple Parent Category URLs
- Remove “?category=” in the URL wordpress ajax filter work for category
- Category Redirection Problem
- wordpress category rewrite rule with pagination
- Link to a specifc category?