Wednesday, February 8, 2023
HomeWordPress Developmenthtaccess - How To Add CSP body ancestors in Wordpress Web site?

htaccess – How To Add CSP body ancestors in WordPress Web site?


I am attempting so as to add Content material Safety Coverage (CSP) body ancestors in .htaccess file to stop our web site from getting iframed on different web sites.
Following is the code:
<IfModule mod_headers.c>
Header set Content material-Safety-Coverage "frame-ancestors 'self';"
</IfModule>
This requires mod_headers to be enabled.
However after we allow mod_headers, it offers us Inner Server Error.

Notice: We have now a plugin put in that makes use of mod_header in .htaccess.
Stop different websites from displaying my web site through iframe

Notice 2: I’m utilizing Apache2 Server

Notice 3 (Very Essential): Once we take away the mod_headers added by the above plugin, the CSP header will get added and no error is encountered.
However we don’t need to take away the plugin / mod_headers added by the plugin.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments