Reputation: 8077
I'm having a bit of an issue with a 301 redirect to fix some client site requirements.
Here's the scenario:
If I go to website.com/case-studies
I would like it to redirect to website.com/case-studies/any/any/any
, however, if we have something like website.com/case-studies/technology/any/any
it shouldn't redirect.
I have tried Redirect 301 /case-studies /case-studies/any/any/any
but this basically put me in a loop of /any
* 30 appearing in the address bar.
Upvotes: 1
Views: 154
Reputation: 785156
You will need to a regex based directive and use anchors. So use RedirectMatch
instead of Redirect
:
RedirectMatch 301 ^/case-studies/?$ /case-studies/any/any/any
Regex ^/case-studies/?$
will match /case-studies
or /case-studies/
but it won't match anything beyond that.
Make sure to clear your browser cache when testing this change.
Upvotes: 1