2

there is a target site like https://target.com/ and i have hosted another site likehttp://mysites.com/index.php.
when users connect to my site i want to redirect them to the target site with manipulated Host header parameter(for example if in normal the host header is target.com i want the user request the redirected site with Host:google.com host header value).
what is the simple way to do it ??? i have already tried header in php and didnt get answer and i dont have enough knowledge to use cUrl to redirect users with new host header.

Mr saeed
  • 21
  • 3

1 Answers1

0

Redirect in PHP can be done with header function: http://php.net/manual/ru/function.header.php In your case it'll look like this:

header("Location: http://target.com/"); 
Iurii Tkachenko
  • 3,106
  • 29
  • 34
  • i mentioned in the question. that i need a way to change host header parameter(which normaly in my example is target.com and i desire to change it to google.com) that user will request. – Mr saeed Oct 12 '16 at 21:23
  • and tnx for destroying my question:) – Mr saeed Oct 13 '16 at 12:58
  • You can change `host` header when you do request from PHP (from the server side with cURL), but when you redirect user you can't do this because headers are set by the browser. Such change is considered to be a security issue: http://security.stackexchange.com/questions/46702/how-can-i-control-the-content-of-the-http-host-header-in-requests-issued-from-my – Iurii Tkachenko Oct 13 '16 at 19:29