The ERR_TOO_MANY_REDIRECTS error occurs because your redirect rule is creating a loop. Here's why and how to fix it:
Why the Error Happens
Your current regex ^/boy/.* matches both:
/boy/ (the parent URL)
/boy/anything (sub-paths)
When someone visits /boy/, the rule redirects to /boy/, creating an infinite loop.
The Fix: Adjust the Regex
Update the regex to exclude the parent URL (/boy/) and only match sub-paths under /boy/.
- Go to: Redirection Plugin > Add New
- Source URL:
^/boy/.*
- Destination URL:
/boy/
- Regex: Checked
- Add a condition to exclude the parent URL.
Method 1: Use a More Specific Regex
Change the regex to ^/boy/.* but exclude the exact /boy/ using a negative lookahead (if supported) or adjust the pattern:
Option 1: Match URLs with at least one character after /boy/
^/boy/.+
.+ means "one or more characters" after /boy/.
- This matches
/boy/shirts/ but not /boy/.
Option 2: Use a Negative Lookahead (Advanced)
^/boy/(?!$).*
^/boy/(?!$) excludes URLs that are exactly /boy/.
.* matches anything after that.
Method 2: Add a Condition to Exclude the Parent URL
If your regex doesn’t support lookaheads, add a condition to skip the parent URL:
- Source URL:
^/boy/.*
- Destination URL:
/boy/
- Regex: Checked
- Add a condition (if supported by the plugin):
- Condition: "URL does not match"
- Value:
^/boy/$
Method 3: Use Wildcards (Simpler)
If regex is too complex, use wildcards but ensure the parent URL is excluded:
Source URL: /boy/*
Destination URL: /boy/
- The
* wildcard matches anything after /boy/, but not /boy/ itself.
Check for Trailing Slashes
Ensure the parent URL (/boy/) and redirect destination are consistent with trailing slashes. For example:
- If your parent URL is
/boy (no trailing slash), adjust the regex to ^/boy(/.*)?$ and redirect to /boy.
Other Causes of Redirect Loops
- Conflicting Plugins: Disable other plugins (e.g., SEO plugins) that might add redirects.
- Server Configs: Check
.htaccess or server rules for competing redirects.
- Caching: Clear your browser cache and any server/CDN caching.
Final Working Example
Source URL: ^/boy/.+
Destination URL: /boy/
Regex: Checked
Redirection Type: 301
This will redirect /boy/shirts/ → /boy/ but leave /boy/ untouched. Let me know if you need further tweaks! 😊