Hello,
most of the content of my site is protected by a sort of paywall. In the same way I want to protect all PDFs uploaded in the uploads folders of wordpress.
I want to do so creating a redirect from all PDFs in said folders to a PHP file that will check if the user can access the PDFs and return it if the answer is affirmative.
In apache I would add two lines like this in the .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/..pdf$ [NC]
RewriteRule ^(wp-content/uploads/.)$ /pdf-check.php?file=$1 [L]
Can I achieve the same kind of redirect using the tool in admin? Or should I ask the support?
The MyKinsta redirects interface does use Nginx rewrite rules, but it will only do redirections. For a rewrite without a redirection, which is what this Apache rule block does, you’ll need us to add the equivalent rules to our Nginx configuration on your behalf.
That way the request can be redirected inside the web server to the PHP file for processing.
You can contact us via chat within MyKinsta or send us an email from the email address that you use to log into MyKinsta at support@kinsta.com.