Override 404 page with htaccess

As far as I can see, it is not possible to use a custom 404 ErrorDocument directive in your htaccess file because WordPress’ index.php will always be found when processing the htaccess content. (unless ofcourse index.php got deleted for some reason) Because index.php is found, it will not trigger the ‘404 not found’ ErrorDocument directive. … Read more

How to hide login form if basic authentication fails?

Managed to figure it out and want to share it with others in case they’re having the same issue. When protecting wp-admin, protect it using wp-admin/.htaccess file, but that only works for the wp-admin directory, and won’t affect the wp-login.php file which is outside that directory. Add protection to the wp-login.php file using the <files></files> … Read more

Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter

There is no built-in way to do it. The .htaccess is “printed in the screen” of the wp-admin ones you are setting up the multisite (the same for wp-config.php). That info is never write directly in .htaccess file like the single site. The wordpress core code for multisite / htaccess is here: https://github.com/WordPress/WordPress/blob/703d5bdc8deb17781e9c6d8f0dd7e2c6b6353885/wp-admin/includes/network.php#L543

Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite

You’re close. I added a few more places to capture more scenarios and used the HTTP_HOST variable in the rule. The $1 is not needed in the condition as that would match what’s captured in the above condition. <IfModule mod_rewrite.c> RewriteEngine On Rewritecond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteCond %{REQUEST_URI} ^/subsite/? [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301] </IfModule> … Read more

Custom Permalink

The custom rule you are trying doesn’t meet the criteria. Here’s a nifty online .htaccess tester tool to see to check rewrite logic. Use the follow RewriteRule instead: RewriteCond %{QUERY_STRING} (^|&)name=(.*) RewriteRule ^(.*)$ /profile/%2/? [R=301,L] Be sure to replace ^example\.com$ on the first line with your actual domain. You can also embed it in the … Read more