Add New Redirect Rule
Redirect Rules allow you to quickly & easily transfer traffic from one source to another.
Usually, this is used to avoid 404 errors. But you're allowed to redirect any page from your site to any other source from your own domain, or you can point it to an outside source of your choice.
In order to add a new redirect rule, please follow these steps:
- Go to Settings -> WP 301 Redirects
- Open the first "Redirect Rules" tab
- Click on the "Add new redirect rule" button
This will open a new window that holds all the settings & options you will need for setting up the redirect.
You have already seen query parameters are, but you are just not aware of that. Query parameters are all those variables that you see after a link. Those are added after the question mark symbol (?) and are used to pass an additional value to the URL.
The most common use is adding a UTM tag at the end of the link that allows you to track visits to your site via Google Analytics. Another common use is affiliate links that need specific ID numbers added to them.
Here's an example: https://www.yoursite.com/blog?utm_campaign=name&utm_medium=email where a query parameter is ?utm_campaign=name&utm_medium=email
Depending on what you want to do when redirecting, you can ignore those parameters, match them exactly in any order, or ignore & pass parameters to the target.
Ignore all parameters
Check if you do not want the WP 301 Redirects to take query parameters into consideration. If checked, the plugin will ignore all the parameters that are displayed after the question mark.
For example, let's say that you have an affiliate link with your affiliate ID attached to the URL like mywebsite.com/affiliate-landing/?aff=123 that you want to redirect to a new URL. If you ignore all parameters, that means that this link would be recognized as mywebsite.com/affiliate-landing/. So no matter which affiliate link gets opened, it would be redirected to a new location.
Exact match all parameters in any order
In cases where you want to make sure that all parameters are present, but you do not care in which order, you should select this option.
For example, mywebsite.com/affiliate-landing/?aff=123&source=facebook and mywebsite.com/affiliate-landing/?source=facebook&aff=123 will both be triggered by the redirect rule since they're basically the same thing.
Ignore & pass parameters to the target
In cases where you need to keep the query parameters as part of the new redirected URL, check this option.
For example, if you redirect mywebsite.com/affiliate-landing/?aff=123 to mywebsite.com/new-landing/, the "Ignore all parameters" (the first one of the options would actually ignore all parameters and redirect to mywebsite.com/new-landing/. But this "Ignore & pass parameters to the target" option would pass the parameters to the new URL and would redirect to mywebsite.com/new-landing/?aff=123
When it comes to domain names, it is important to know that those are not case sensitive. That means that https://wp301redirects.com and https://WP301REDIRECTS.COM is the same exact thing, and no matter how you type it, you will end up on the same website.
But it's also crucial to understand that everything that goes after the domain name & the top-level domain can be case sensitive. So, in the same example, https://wp301redirects.com/blog is not the same as https://wp301redirects.com/BLOG. While this is technically true, please note that most of the modern hosting services usually treat this kind of URLs as the same. So in the example before, you would still end up on the same page. However, this depends on the servers and what you want to do.
Because of that, when doing a redirection, you can set the URL to be case insensitive or vice versa.
Not all redirects are the same. While the most common one is a 301 redirect, there are situations in which you will need to return a specific status code.
- 301 Redirect - a permanent redirect. Used when the old URL does not exist anymore or when you want to permanently move to another location. Browsers will cache this redirect and always open the new URL. Changing the rule will require clearing the browser cache of visitors.
- 302 Redirect - a temporary redirect. Used when a document is only temporarily unavailable and you plan to remove the redirect in the future. Browsers will not cache the redirect and will check each time if it is still active.
- 304 Redirect - not modified. It indicates that the resource was not modified since the last request.
- 307 Redirect - temporary redirect, which guarantees that the method and the body will not be changed when the redirected request is made.
- 308 Redirect - a permanent redirect. Used when you want to make sure the redirected location uses the same exact request (for example, POST)
- Cloaking - hide target URL by Source URL
The Position allows you to choose the order in which the redirection rules will get checked & executed.