When Should I Use the Regular Expression Option for Redirects?
Questions:
- When do I actually need the Regular Expression option in redirects?
- Can I redirect multiple URLs using one rule?
- What problems does Regular Expression help solve?
- Is Regular Expression required for simple redirects?
Description:
The Regular Expression (Regex) option is useful when you want one redirect rule to handle many similar URLs instead of creating redirects one by one.
It’s especially helpful when URLs follow a pattern—like old blog posts, product pages, or category paths. If you’re only redirecting a single page, you usually don’t need Regex. But if you want smarter and cleaner redirect rules, Regex can save a lot of time.
Solution:
How to Use Regular Expression in Redirects?
-
Make sure you’re logged in
You need to be logged in to create roles and manage access.
- Click 'System'
- Navigate to System Settings → Redirect URLs
-
Click New to create Redirect
- Enter the Source URL (e.g., /old-page)
- Enter the Target URL (e.g., /new-page)
- Select the Redirect Type (301, 302, or Silent)
- Enable the Active toggle
- Enable Is Regular Expression toggle
- Click Save
- One rule will now redirect all matching URLs.
Tips and Tricks:
💡Things to remember
-
Use Regex only when redirecting multiple similar URLs
-
Avoid Regex for simple one-page redirects
-
Test your redirect carefully before using it live
-
A small mistake in Regex can affect many URLs
-
Keep patterns simple and clear
-
Disable the rule instead of deleting it if you need to test changes