301 redirection with trailing slashes on WordPress


With WordPress redirection plugins you can easily set page 301 redirects. But sometimes redirection not involve “trailing slashes” (trailing slash means the slash at the end of an URL).

For example, if you want to jump from get-in-touch page to conctact-us page,  a simple redirection means that www.mysite.com/get-in-touch and www.mysite.com/get-in-touch/ could be not considered as the same URL, so redirection could land on different page.

The solution is to use regular expressions (regex).

Here are two ways to using regex to include trailing slashes in URL recognition:

 Add the code [/]? at the end of the URL

So, in the example, jump from get-in-touch[/]? to contact-us

 Add the code /?$ at the end of the URL

So, in the example, jump from get-in-touch/?$ to contact-us

Leave a comment

Your email address will not be published. Required fields are marked *