in web server, have these files. don't want user find out real path "p1.jpg" , "p2.jpg".

when show "p1.jpg" in "index.php", how hide original path "/images/p1jpg" "/photo/p1.jpg". possible?
so see it, there 2 parts this.
1) make contents of images/ hidden
2) make person can access photos/somefile.jpg , have server serve images/somefile.jpg
1) hide contents of images/
create .htaccess file in images/ , put following in it
order allow,deny deny 2) serving file
create .htaccess file in photos/ , put following in it
rewriteengine on rewriterule ^([a-za-z0-9_.-]+).jpg$ photo.php?image_name=$1 and create php file photo.php in photos/ directory
<?php if(isset($_get['image_name'])){ if(file_exists("../images/" . $_get['image_name'].".jpg")){ header('content-type: image/jpg'); readfile("../images/" . $_get['image_name'].".jpg"); } } i'm doing blind, test in sec!
Comments
Post a Comment