Bulk edit .htaccess

Hi Guys,

Is there a way to paste a code into the .htaccess file for multiple sites over mainwp? Example:

I want to add this code to the .htaccess file of all my websites:

# START Security Headers
<IfModule mod_headers.c>
  Header set X-Frame-Options "DENY"
  Header set X-XSS-Protection "1; mode=block"
  Header set X-Content-Type-Options "nosniff"
  Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
  Header set Referrer-Policy "no-referrer"
  Header set Permissions-Policy "accelerometer=(); autoplay=('self'); camera=(); encrypted-media=(); fullscreen; geolocation=('self'); gyroscope=(); magnetometer=(); microphone=(); midi=(); payment=(); picture-in-picture=('self'); usb=()"
  Header set Content-Security-Policy "default-src 'self'; script-src 'self' https://www.google.com; img-src 'self'; style-src 'self'; font-src 'self'; object-src 'none'; frame-src 'self'; worker-src 'self'; connect-src 'self'; report-uri /security-report.php"
# END Security Headers

Hi eci,

thanks for reaching out.

There is no way to post this code to the .htaccess file, but only to upload the whole .htaccess file via the File Uploader extension.

Since .htaccess file is not supported out of box, you will have to use this filter to add support:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.