Disabling direct access to images using .htaccess

I have added the following rewrite rule to my .htaccess (above the previous rewrite rule): RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L] You presumably have another .htaccess file in the /wp subdirectory that contains the main WordPress directives (ie. # BEGIN WordPress etc.). You should be adding the above rule to the /wp/.htaccess file, not the one in …

Read more

Rules in .htaccess only if the requested URL is /wp-admin

Try something like this instead: <If “%{THE_REQUEST} !~ m#\s/wp-admin#”> Header add Content-Security-Policy “default-src ‘self’;” Header add Content-Security-Policy “script-src ‘self’;” </If> This should set the two headers only when the requested URL does not start with /wp-admin. The check is against THE_REQUEST (as opposed to REQUEST_URI) since REQUEST_URI changes when the URL is rewritten by the …

Read more

blocking access to all post/tag URIs via htaccess

RewriteCond %{REQUEST_URI} ^post/tag/ RewriteRule .* – [F] The REQUEST_URI server var does start with a slash (it is a full root-relative URL-path), although you do say you have tried this “with and without the leading slash”, so this should have worked if that is what you are referring to and /post is the first path-segment …

Read more

WordPress slugs and 404 handling takes preference over folders in site root?

For beta testing use either a separate domain or at least a subdomain in another directory than your live site. If you absolutely have to use the current setup install a plugin that offers password protection like Members or change the .htaccess rules to: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # …

Read more

TimThumb & htaccess : clean url

Cadeyrn’s code work probably for 1 specific size ( 200&w=350& etc) , the major problem with timthumb and the reason people use it, is that it allows for many dynamic sizes thus making .htaccess rewrite rules much more difficult, especially if you using friendly WordPress permalink structure. There is a guide here on how to …

Read more