开发者

php pdf file output contents

I have a list of PDF [myfile.pdf] files on a folder/dir called example开发者_高级运维.com/uploaded/downloads/

I need a user to download or view on the page a pdf file, however I do not want them to see the uploaded on the url, which is the best way to do it? so users can click a link example.com/downloads/

I had a .htaccess code (since im not good at it) it got me no where

RewriteRule ^downloads/([A-Za-z0-9-]+) /uploaded/downloads/$1 [L]

I have tried PHP header('... application/pdf'); not good either.

PLEASE NOT: example.com could change directory aswell e.g. example.com/new_design/ therefore the dir would be example.com/new_design/uploaded/downloads/ and users should be able to see example.com/new_design/downloads/

TIA


Make sure you have the RewriteEngine turned on and try this slightly modified pattern.

RewriteEngine on
RewriteBase /
RewriteRule ^downloads/(.*)$ uploaded/downloads/$1 [L]

If you are still having trouble, try looking at the Apache log files. They may indicate a problem with permissions or the file path. The log file is usually located in /var/log/apache2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜