Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Implementation of the "X-Frame-Options" header

Update 08/07/2026

This guide explains how to use the HTTP header X-Frame-Options to limit the display of your pages in frames (<frame> and <iframe>) and help protect against clickjacking attacks.

The ALLOW-FROM value is no longer supported by modern browsers. If you want to allow one or more specific domains, use the Content-Security-Policy (CSP) header with the frame-ancestors directive instead.

 

X-Frame-Options Header Values

The HTTP X-Frame-Options header indicates to the browser whether a page can be displayed within a <frame> or <iframe> tag.

  • DENY: completely prohibits displaying the page in a frame, including from your own site.
  • SAMEORIGIN: allows display only when the page is embedded from the same domain.

 

Setting up the header

To apply this protection to your entire site, add the following directive to the .htaccess file:

Header set X-Frame-Options "SAMEORIGIN"

You can also send this header from a PHP script:


Allow a specific domain with Content-Security-Policy

 

Autoriser un domaine spécifique avec Content-Security-Policy

To allow an external domain to embed your content in an iframe, use the Content-Security-Policy header with the frame-ancestors directive.

Example:

Header set Content-Security-Policy "frame-ancestors 'self' https://domain.xyz"

This rule allows your own site ('self') as well as https://domain.xyz to embed your pages in an iframe.


Has this FAQ been helpful?