Tags
PHP
Asked 2 years ago
7 Apr 2022
Views 633
david

david posted

how to set X-Frame-Options in PHP

How to set X-Frame-Options in website. my website is made on the PHP , i am trying to avoid Clickjacking attack

iPhone-coder

iPhone-coder
answered Apr 7 '22 00:00

put any of below following lines at htaccess

Header set X-Frame-Options: "SAMEORIGIN"   

embed Allow for Same Origin


 Header set X-Frame-Options: "DENY"  

embed DENY for all
sandip

sandip
answered Apr 7 '22 00:00

in PHP you can send a header with X-Frame-Options,
below code send X-Frame-Options as deny. so no one can embed the website at any other website or same website


header("X-Frame-Options: DENY");
 


below code send X-Frame-Options as SAMEORIGIN.so no one can embed website at any other website but in the same website , it can be done

header("X-Frame-Options: SAMEORIGIN");
Post Answer