How do you protect a website from a DDoS attack?
The main protection is a specialised service or CDN that filters malicious traffic before it reaches your server. In addition, request rates are limited, pages are cached and the server's direct address is not exposed. Protection is set up in advance: connecting it during an attack is harder.
More in the guide web application security; send a request on the development page.