PHP: changing abstract with header ()

My CMS links to other sites for convenience, and I would like to hide the referent so that other sites do not see the directory and query string of my CMS. Now I have a CMS link to the elswhere PHP file on my server, which in turn is redirected to the link via header (), but the referent is still from my CMS, and not from the PHP binding. Moreover...

header("Referer: nowhere"); header("Location: $_REQUEST[urltolinkto]"); 

... Seems nothing changes. No matter what I put as the referent, this is always one of my CMS, where the user actually clicked on the link.

Is it possible to change the referent (to the PHP link), or do I need to use javascript or meta update?

+4
source share
2 answers

The Referer header is what the browser sends to the server. You change the response from the server to the browser, so this will not work (unlike the Cookie header). As far as I know, you have no control over the browser on the server when sending the Referer.

+8
source

The browser manages to choose what to send to the referrer, but there are ways to get around it.

HTML5 added a meta referrer, most modern browsers will respect it. Just add

 <meta name="referrer" content="no-referrer"> 

for your site.

There are also redirection services and other hacks to hide ref (https redirects, iframe tricks and others).

0
source

Source: https://habr.com/ru/post/1400372/


All Articles