Ignoring the Trailing Slash in Redirects

Did you know that you can create redirects in All in One SEO Pro that will ignore whether there's a trailing slash at the end of the URL?

This is especially useful in catching visitors that may go to your site but leave off the trailing slash.

For example, a visitor may type in https://mydomain.com/blog/ to reach your blog. This URL has the trailing slash at the end of the URL.

However, visitors may also type in https://mydomain.com/blog to reach your blog. This URL doesn't have a trailing slash at the end of the URL.

When you create a redirect, you have the option to redirect the URL without the trailing slash, or the URL with the trailing slash, or both.

Ignore Trailing Slash for a Single Redirect

Here's how to ignore the trailing slash in a single redirect:

To get started, go to Redirects in the All in One SEO menu.

Redirects menu item in All in One SEO menu

You'll see the Redirects screen and at the top will be the Add New Redirection form.

Add New Redirection form on the Redirects screen in All in One SEO

In the Source URL field, enter the URL you want to redirect from. The URL must be a relative URL, i.e. don't include the https://mydomain.com part of your URL. You can add the trailing slash or leave it off.

Now click the settings icon on the right side of the Source URL field.

Settings icon in the Source URL field in the Add New Redirection form

You'll see three checkboxes, one is for Ignore Slash. Check this box and the trailing slash will be ignored for this redirect only.

Ignore Slash checkbox in the Add New Redirection form

In the Target URL field, enter the URL you want to redirect to. The URL can be either a relative URL or an absolute URL.

Target URL field in the Add New Redirection form

You can also start typing the title of any post, page or other content on your site, or the slug or ID in the Target URL field and the matching content will be displayed. Click on the post or page you want to select as your target.

In the Redirect Type drop down, select the type of redirect you want. The two most common are:

  • 301 Moved Permanently: Use this if you want to permanently redirect the old URL because the content has been deleted or moved.
  • 307 Temporary Redirect: Use this if you only want to temporarily redirect the old URL
Redirect Type drop down in the Add New Redirection form

Click the Add Redirects button to add your redirects.

The redirects will be shown in the Redirects table.

Multiple redirects shown in the Redirects table

Ignore Trailing Slash for all Redirects

If you want to ignore the trailing slash for all redirects that you create, then start by going to Redirects in the All in One SEO menu and then click on the Settings tab.

Settings tag in the Redirection Manager in All in One SEO Pro

Scroll down until you see the Redirect Defaults section and you'll see a setting for Ignore Slash.

Ignore Slash in the Settings for the Redirection Manager

Click the toggle to enable this setting. Now all redirects will ignore the trailing slash in the source URL.

Check out more documentation on our Redirection Manager here.

This feature was added in All in One SEO version 4.1.0.