0

Our site has two websites with different domains. For security reasons, we want to sanitize the URl which has tags. I am not sure how to add a case insensitive redirection applicable for both domains for this scenario in routes.yaml through the regex.

Example:

Domain 1: www.domain1.com

Domain 2: www.domain2.com

I want the URLs which has tag in it either in the path or as a query string to be redirected to the specific domain home page.

www.domain1.com/cms/\<script> ---> www.domain1.com

www.domain2.com/test?\<script> ---> www. domain2.com

1 Answer 1

0

I'm with Magento Cloud. You really can't do that kind of redirect in the routes.yaml file. It's not an effective place to do security filtering, and the redirect only looks at the domain and path, not query parameters, so it wouldn't be able to filter that part of the URL anyway.

Generally speaking, complex redirects should be implemented in the application, not at the routing level. And filtering out HTML or JS from the URL shouldn't be handled by a redirect at all.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.