简体   繁体   中英

How to Protect PHP Url From Direct Accessing?

I am using a web link eg: http://example.com/abc/abc.php for retrieving JSON Data in my Application eg windows phone.

Everything works fine but the url can be direct accessible from the browser. I don't want the url to be direct accessible.

How to Protect the Url from Direct Access but Allow from the App?

You can either use something like .htaccess (it's a file that you can use to do url rewriting and redirecting) , and no . . . I don't know a lot of about that, so you'd have to look up how to do it.

but, if your file is a php or phtml file, then you could just write:

<?php

// just redirect someone away from the file whenever they go to access it.
header("location: your/location/file.php");

?>

Anyways, that's about all I can help with, hopefully I was successful as answering this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM