Forum Moderators: phranque

Message Too Old, No Replies

Access to pdf after signup?

is this possible?

         

camball

3:06 pm on Feb 12, 2010 (gmt 0)

10+ Year Member



Hello, I am a newbie to .htaccess and I have a question if something is possible. I have tried to look this up but I have not found anything.

The site im working on had quite a few pdf files that people are looking for. Many people find them through search engines and download them.

When people want to view these pdf files, I want to send them to a page where they submit their email, area code and name. After that they can get access to the pdf file. Is this possible?

Also can I make it so some web search spiders can still see the pdf files with SetEnvIfNoCase?

Thanks in advance for your help

jdMorgan

1:54 am on Feb 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you put all .pdf files into one directory, or under one directory?

If so, you can use basic Apache authorization/authentication to password-protect them. But then you need to work out how to assign/generate usernames/passwords and send them to the requestors.

Alternately, you can mark the pdf directory-area as inaccessible via HTTP, and then use your "signup script" to give the signed-up users a cookie. Then you use a second script to check for that cookie, and if set, read in the requested pdf file and send it to the client. Because pdfs would only be read on the server by this script, there would be no need to have the pdf directory be directly-accessible to the Web.

The tough part about search engines is that you will need to define how "strictly" you intend to identify them. This might vary all the way from simply looking for "Googlebot" and "Slurp" in the user-agent string --ignoring the many spoofers of these 'bots-- to full-on user-agent string analysis and correlation with requesting IP address ranges, valid HTTP request headers, etc. It basically depends on how much the pdfs are worth, and therefore, bow much you're willing to invest in maintaining the data used to identify these 'bots to a level of commensurate to that worth.

So, yes it's possible, but may take you several days (or weeks) and may require quite a bit of scripting to get it to work the way you want. You might want to look around for existing scripts you could buy/copy/modify -- you're basically "selling" pdfs for e-mail addresses instead of direct payment in money.

Jim