Search code examples
phphtmlapache.htaccesshttp-headers

Referrer-Policy with PHP and htaccess


is there any way to overwrite the header referrer policy using htaccess or PHP?

HTML Code :

<meta name="referrer" content="origin">

Is any way to do same with htaccess or PHP? i tried these code from How to set Firefox referrer to "no-referrer" using PHP Referrer-Policy?

I tried (PHP) :

header("Referrer-Policy: origin");

With Htaccess :

<IfModule mod_headers.c>
    Header set Referrer-Policy "origin"
</IfModule>

Still it not overriding strict-origin-when-cross-origin.

Firefox info : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy


Solution

  • I tried in private browser and it worked !!

    <IfModule mod_headers.c>
        Header set Referrer-Policy "origin"
    </IfModule>