Laravel, Web Server

Securing and Optimise Your Application with .htaccess


I just came through with some of the requirement where I need to secure my Laravel application, and also to speed up, my application. You may use it in your application, put it on document root and make sure related module to your web server is loaded.Here are some of the requirement to secure my application:

  1. Prevent Directory Listing
  2. Prevent Server Information Display in Response Header
  3. X-Frame-Options
  4. XSS Protection
  5. Specify X-Content-Type-Options
  6. Block bad bots
  7. Disable TRACE Method
On optimisation, it’s on:
  1. Expiry
  2. Compression
Following are the overall setup of the .htaccess: