Site in subfolder – all pages work except home

Because when you request the document root, the rule in .htaccess does not match and the request is not rewritten to the subdirectory. So the request falls through and whatever is the default response for the document root is served (eg. /index.php if it exists). You need to add another directive to rewrite the homepage … Read more

How can I set Cache TTL for woff and woff2 font files with htaccess?

ExpiresByType font/woff2 “access plus 1 year” ExpiresByType application/font-woff2 “access plus 1 year” ExpiresByType application/x-font-woff2 “access plus 1 year” You need to set ExpiresActive On (at the top) for these directives to have any effect. You also don’t need all 3 of these directives. You should check the Content-Type HTTP response header for the mime-type your … Read more

Point all URLs to homepage but maintain URL

Add this code to the functions.php file of your (child) theme or as a plugin- add_action( ‘init’, ‘wpse_393237_add_any_endpoint’ ); function wpse_393237_add_any_endpoint() { add_rewrite_endpoint( ‘.*’, EP_ALL ); } Please note, you may need to flush the rewrite rules if you see a 404 error. (simply saving the permalink does the trick) Ref: https://developer.wordpress.org/reference/functions/add_rewrite_endpoint/

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