Hello I have used codeigniter to develop my website but when my website is searched in google , google shows up links to the files (pdf) in a particular folder and user can view these files (pdf) directly without login. I want to restrict google to directly show the links to these files. ex: www.mywebsite/myfolder/myfile
Please guide me how can I accomplish this. Thank you.
Basically you need to host the files outside of the public_html folder - and instead serve them up to users via php readfile().
Something like this would work
Note: you need to be careful of directory transversing - so you should put in some checks that the filename is only made up of letters
A little modification from the previous answer :
Place the .htaccess in your file folder with the content
This will deny all access to that particular folder.
For accessing the files write a function in controller with body -
then you have to add some line to your routes.php file in your config folder as like this
this will redirect all request to myfiles/bla_bla_bla to my_controller/index/bla_bla_bla
think this may help :)