Home > Enterprise >  WordPress: can't achieve direct image access redirection via .htaccess
WordPress: can't achieve direct image access redirection via .htaccess

Time:10-05

My goal is the following: when a user tries to access an image (or any other attachments in /wp-content/uploads/) I need to redirect him to a processor PHP file that will check if a user is logged in and the file is uploaded by that user.

I've come to this solution so far:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/.*
RewriteRule ^wp-content/uploads/(.*)$ file-processor.php?file=$1 [QSA,L]
</IfModule>

And it just doesn't work.

  • Related