I have the following regex in my vhost conf:
location ~* ^/!/[^a-zA-Z0-9] {
return 301 $scheme://$http_host;
}
But it only appears to match the first character:
# Redirects to https://shouttag.com correctly
https://shouttag.com/!/!pink
# Does not redirect as expected
https://shouttag.com/!/p!nk
Variations I have tried:
# Assume that $ is unnecessary b/c I don't know what the end of the url may be
location ~* ^/!/[^a-zA-Z0-9]$ {
# Only seems to work when capturing data via group syntax ()
location ~* ^/!/[^a-zA-Z0-9]+ {
Thanks.
You can try this rule:
location ~ ^/!/[a-zA-Z0-9]*[^a-zA-Z0-9].*$ {
return 301 $scheme://$http_host;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With