How can I hide the image path? -Php Tutorial

Source: Internet
Author: User
How can I hide the image path? Hide the real path in the source code of the webpage, but click the link to open it on the new page.

Write the following statement:
$ _ F = readfile ($ _ p); header ("Content-type: image/*"); echo $ _ f;

Click the src path in the source code. the php file is downloaded.


Reply to discussion (solution)

Url rewrite

Url rewrite

The server cannot be moved.

However, RewriteRule can be used.

I don't think you can do this without modifying the server or hiding the img path from the source code ....

I don't think you can do this without modifying the server or hiding the img path from the source code ....


No .. I mean, I cannot change the server configuration. You can use it later, and it will not Download php.

Before sending the output image, there cannot be any echo, even if it is echo '', an error will occur. So all of them are replaced by redirection to the 404 page.


Url rewrite

The server cannot be moved.



Then you change the header ("Content-type: image/*"); in your code to the specific image type, and this method is called before all outputs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.