How to create a redirect in PHP if the url is a specified? -
After
I want to redirect local hosts to my ip in a file. If I see it with my IP then there is no redirection I have some code writed but do not do any work
"; // resonant $ _SERVER ['SERVER_NAME'] $ _ server ['REQUEST_URI']; // if $ real_link =; // if $ _SERVER [REQUEST_URI] = "/docs/headertest.php" {// header ('location: http: //MYIP/docs/headertest.php')}; // $ url = "$ _SERVER [HTTP_HOST] $ _ server [REQUEST_URI]"; // echo $ url; // if $ url = "localhost / docs / headertest.php" {// resonance "AD";}; // headers ('location: http: //MYIP/docs/headertest.php');}; $ url = "http: //" $ _ Server [HTTP_HOST]. $ _ Server [REQUEST_URI]; $ Localhost = "http: //localhost/docs/headertest.php"; If $ url = ($ local host) {header ('location: http: //MYIP/docs/headertest.php');}? & Gt; Thanks.
should be:
$ url = "http: / / ".. $ _ Server [HTTP_HOST] $ _ server [REQUEST_URI]; $ Localhost = "http: //localhost/docs/headertest.php"; If ($ url == $ localhost) {header ('location: http: //MYIP/docs/headertest.php'); }
Comments
Post a Comment