Reputation: 177
Didn't found in any of answers this, that's why I'm asking it.
Basically, I need to 301 redirect URL that contains some specific character in it, but dynamically.
Specific character is "/l/"
For example:
- example.com/l/test should 301 redirect to example.com/test
- example.com/test/1/2/l/3 should 301 redirect to example.com/test/1/2/3
Basically it means that any url containing "/l/" should be the same url, but without "/l/"
Restrictions:
- /l/ can be anywhere in url.
- url is dynamic
Thanks!
Upvotes: 1
Views: 1704
Reputation: 784918
You can use this rule in root .htaccess:
RedirectMatch 301 ^(.*?/)l/(.*)$ $1$2
Upvotes: 1