I'm trying to make URL's look better by using a RewriteRule in .htaccess, but it doesn't work.
This is the case. I have a root folder in which there is a PHP-file called pdf.php. The script in that file sends a PDF-file to the user, which name is given as a variable in the URL. The PDF-files are in a folder called pdf, placed in the root. That folder is protected so that it's only possible to get a PDF-file by using the script. All that for security reasons.
You can download the PDF-files when you go to http://example.com/pdf.php?file=pdf/File.pdf for instance, where pdf/File.pdf is the path to the PDF-file. That's working fine. I want it to work when you simply go to http://example.com/pdf/File.pdf, so that URL has to be rewritten to the one mentioned before.
I tried to make a RewriteRule using a generator, but it doesn't work. The following rules are in the .htaccess-file in the folder pdf. Placing it in the root didn't work either.
Options +FollowSymLinks RewriteEngine On RewriteRule ^pdf/([^/]*)$ /pdf.php?file=pdf/$1
The protection of the folder pdf is as follows.
ErrorDocument 403 http://example.com/ Order deny,allow Deny from all