Reputation: 5374
A Newsletter was send with a token generated login URL inside. Accidentally a closing square bracket ] was placed as the URL's last character and the login links now doesn't work. How to redirect any URL with a closing square bracket to the same URL without the square bracket?
Upvotes: 1
Views: 195
Reputation: 143906
You can either use mod_alias and the RedirectMatch
directive or mod_rewrite and the RewriteRule
directive. If you already are using mod_rewrite elsewhere, it may be more prudent to stick with mod_rewrite, otherwise it doesn't matter:
RedirectMatch 301 ^/(.*)\]$ /$1
or
RewriteEngine On
RewriteRule ^(.*)\]$ /$1 [L,R=301]
Upvotes: 1
Reputation: 785471
You can use this rule:
RewriteEngine On
RewriteRule ^(.+?)]$ /$1 [R=301,L,NE]
Upvotes: 0