To ensure all URLs end with a trailing slash (e.g., /example/
instead of /example
), add the following rules based on your server:
For Apache
Add this code above the FlyingPress rules in your .htaccess
file:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>
For Nginx
Add this rule to your site configuration:
if ($request_uri !~ "^/wp-json") {
rewrite ^([^.]*[^/])$ $1/ permanent;
}
These rules exclude /wp-json
to avoid breaking the WordPress REST API.