3000 3000 - 10 months ago 76
Apache Configuration Question

Rewrite htaccess rule

In the root of a WordPress website I have an htaccess file. Inside the htaccess file I have the following:

RewriteRule ^wp-content/(?!themes/.*/feather/css/custom\.css\.php$)(.*)\.php$ [R=404,L]

This denies direct access to .php files through http (it serves a 404).

Now, in the website backend there's a plugin that creates pdf files when you click a button. It does it by redirecting the browser to:


Problem is this is blocked by the htaccess rule, so when you click you get a 404.

Is there any simple way to exclude this path from the htaccess rule?

Any help is appreciated


Add one more alternation in your negative lookahead regex:

RewriteRule ^wp-content/(?!(themes/.*/feather/css/custom\.css|plugins/createpdf/core/createpdf)\.php$).*\.php$  - [R=404,L,NC]