/    Sign up×
Community /Pin to ProfileBookmark

No direct access

Hi,

I have a folder named download and the administrator uploads PDF’s within that section. These PDF’s can only be accessed with username password and within the website. Is it possible not to allow people to who write the PDF’s name directly through the address bar not to access the file?

for example the link is: [url]http://www.something.com/download/123.pdf[/url]

I have actually made a file named index.php within the download folder so that people who write [url]http://www.something.com/download/[/url] get redirected to the no access page (is this the right way to do it?)

but still no control on people who actually write the url with the file name.

Thanks alot.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 31.2007 — If running on Apache, you could redirect all .pdf requests to another file -- perhaps a generic 404 error sort of file. Just add a .htaccess file to the directory with the PDF's:

.htaccess
<i>
</i>RewriteEngine On
RewriteRule .pdf$ http://www.yoursite.com/error404.html
×

Success!

Help @XeroSiS spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...