I have a php file that needs to be called directly. It renders PDF content and outputs it via application/pdf headers so the user doesn’t leave the page they called from.
This php file is located in the depths of my php libraries folder structure. I’m currently linking to the php file like so:
<a href="myserver.com/path/to/actual/phpFile/downloadPDF.pdf?arg1=blah&arg2">
I would rather my users not know details like directory names and php files. Security by obfuscation, right?
What’s the best way to create a redirect that does what I’m looking for?
The easier solution is to find or create
.htaccessfile which you should then place in thehtdocsdirectory.Add these lines of code in it:
Then you can call your pdf file with