user2901740
user2901740

Reputation: 1571

How to change File path to PDF that is being displayed in address bar?

I have this PDF file that was made in PHP file..I only view the generated PDF, and not saving to my computer,. the location of the PHP file is something like this for example.

localhost/this/is/my/very/long/file/path/tcpdf/myfile.php

When generating PDF, that very long url is the one displaying on the address bar. I want to display only the PDF file name to the address bar instead of that long url example

localhost/myPDF/myfile.php

Any Ideas?

Upvotes: 0

Views: 503

Answers (2)

Rick van Bodegraven
Rick van Bodegraven

Reputation: 179

You could try using url rewriting to fix it, but you'd probably have to either route the downloads through a script, or find a way to make the rewrite be able to figure out which PDF to open from a given url.

Edit: Upon re-reading the question, you definitely want to use this method. Route the url to your php endpoint, using apache or nginx (depending on which you use to host the script) url rewriting capabilities.

Upvotes: 1

Realitätsverlust
Realitätsverlust

Reputation: 3953

When you generate the PDF, copy it into a folder with the shorter path. That would probably the easiest solution.

Upvotes: 0

Related Questions