codehaven - php snippets - coding help
Generic filters
Exact matches only

Slash canonicalization at the end of the URL – htaccess

13th April 2022

Admin WP

wordpress category

If you have a website, you should always use the forward slash at the end of all urls.
If for some reason you do not, then this code is very helpful.

To remove a slash at the end:

example: –

To add a slash to the end

example: –

Was this code snippet helpful?