How to Exclude URLs from Redirection Rules in WordPress
Content
A common challenge when using the Redirection plugin is creating a broad rule, only to find it's also affecting specific URLs you want to leave alone. Users often report that the "Do Nothing" action doesn't seem to work for excluding these URLs. This guide explains why this happens and provides the most effective solutions.
Why the "Do Nothing" Action Might Seem to Fail
Based on community reports, the "Do Nothing" action is functional, but its success depends on two critical factors that are often overlooked:
- Rule Order: Redirection processes rules from top to bottom. A specific "Do Nothing" rule must be placed above any general rule that would otherwise match the same URL. If a general regex rule higher up the list matches a URL first, the later "Do Nothing" rule will never be triggered.
- Caching: Both WordPress and server-side caching can serve old redirects. If you change a rule but don't clear all relevant caches, you will continue to see the old (cached) behavior, making it appear as if your new rule is not working.
How to Successfully Exclude URLs
Follow these steps to correctly set up URL exclusions.
Step 1: Create the "Do Nothing" Rule
First, create a new redirect for the exact URL or pattern you wish to exclude.
- In your WordPress admin, go to Tools > Redirection.
- Click Add New to create a redirect.
- Enter the source URL you want to exclude. For a single, specific URL, enter it directly (e.g.,
/blog/my-news-article/). To exclude a pattern, you may need a simple regex. - Set the Action to "Do Nothing (ignore)".
- Click Add Redirect.
Step 2: Check the Rule Order (Crucial Step)
After creating the rule, you must ensure it is positioned correctly.
- On the main Redirection page, view your list of redirects.
- Find your new "Do Nothing" rule. Click and drag it using the handle on the left side of the table to place it above any broader, matching rules.
Step 3: Clear All Caches
To ensure your changes take effect immediately, clear all caching layers:
- Clear your WordPress caching plugin's cache (if you use one like WP Rocket, W3 Total Cache, etc.).
- Clear any server-level or CDN caches (e.g., Cloudflare). Your hosting provider's control panel typically has this option.
- Clear your browser cache or test in a private/incognito window.
Alternative Solution: Refine Your Regex
Sometimes, a better approach is to refine your original redirect rule to be more specific so it doesn't match the URLs you want to exclude in the first place. This is often more efficient than managing multiple rules. The Redirection support site has extensive documentation on using regular expressions to create precise matching patterns.
Conclusion
The "Do Nothing" feature is a powerful tool for creating exceptions within your redirect strategy. The most common reasons for it not working are incorrect rule order and caching. By carefully ordering your rules and ensuring caches are cleared, you can successfully exclude any URL from being redirected.
Related Support Threads Support
-
Exclude urls from redirecthttps://wordpress.org/support/topic/exclude-urls-from-redirect/
-
How to redirect all domain urls?https://wordpress.org/support/topic/how-to-redirect-all-domain-urls/
-
Exclude Blog url Redirectionhttps://wordpress.org/support/topic/exclude-blog-url-redirection/
-
Redirect www to non wwwhttps://wordpress.org/support/topic/redirect-www-to-non-www-3/
-
make redirect work on one loop instead of multiple loopshttps://wordpress.org/support/topic/make-redirect-work-on-one-loop-instead-of-multiple-loops/
-
Redirect helphttps://wordpress.org/support/topic/redirect-help-7/
-
Redirect only bloghttps://wordpress.org/support/topic/redirect-only-blog/
-
redirecthttps://wordpress.org/support/topic/redirect-175/
-
Redirect all category and category postshttps://wordpress.org/support/topic/redirect-all-category-and-category-posts/
-
Bulk Redirecthttps://wordpress.org/support/topic/bulk-redirect-3/
-
Mass Redirectshttps://wordpress.org/support/topic/mass-redirects/
-
Redirecting the blog posthttps://wordpress.org/support/topic/redirecting-the-blog-post/
-
urls that contain …https://wordpress.org/support/topic/urls-that-contain/
-
Redirect all postshttps://wordpress.org/support/topic/redirect-all-posts/