D
D
dima_horror2013-10-16 17:37:59
PHP
dima_horror, 2013-10-16 17:37:59

Rewrite files

The question is:

Is there a .htaccess

RewriteEngine On
Options +FollowSymlinks 
RewriteBase /
RewriteRule ^(20[0-9]{2}/[0-9]{2}/(.*)) /download.php?path=$1&file=$2

When asked to download a file, it should “slip” another page.
* If you enter domain/wp-content/uploads2/2013/10/AOY25RZBL_schematics.pdff - everything works ...
* If you enter domain/wp-content/uploads2/2013/10/AOY25RZBL_schematics.pd - it also works ...
* (if you enter a non-existent file , even with the PDF extension, for example domain.ua/wp-content/uploads2/2013/10/noFile.pdf , it works)
* But if you enter domain/wp-content/uploads2/2013/10/AOY25RZBL_schematics.pdf - it doesn't work , offers to download the file.

Those. there is a check - whether the file exists, and it does not reach my rule. How to disable the check or set a priority?

RewriteCond %{REQUEST_FILENAME} -f 
Does not help.

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
edogs, 2013-10-16
@dima_horror

Checking for the existence of a file should not go in this case, so the reason is different.
Here we see 2 options
1) You have nginx in front of Apache, which is directly involved in distributing statics (then we don’t quite understand what to do - we probably need to go to the sysadmin / hoster, but at least it’s clear where the problem is).
2) You have some kind of pdf handler on your server that intercepts requests to pdf (it is easy to check by requesting an existing file with a known unknown extension).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question