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

Drawbacks to using Options -Indexes

There are some legitimate use cases for enabling Indexes but they’re probably not applicable to most sites (especially WordPress sites). For example Indexes are helpful on file storage mirrors where you want to provide readonly access to a subset of folders & files without having to build your own UI. As a best practice, yes, … Read more

403 error on admin login page

I managed to enter the admin page finally! So I added these two lines to wp_admin.php: define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’); afterward deleted the .htaccess file, then deleted browsing history, cleared cache and cookies. After all of this I could enter the admin page. Then I went to options/general and options/permalinks and saved the setting, it generated a … Read more

How can I enable keep alive (Not accessing to Apache)

Check out wp_headers filter: /** * Filter WordPress headers before sent * * @see https://developer.wordpress.org/reference/hooks/wp_headers/ */ function wpse_289493($headers, $wp) { foreach ($headers as $key => $value) { if (‘connection’ === strtolower($key)) { unset($headers[$key]); } } $headers[‘Connection’] = ‘Keep-Alive’; return $headers; } // Add filter add_filter(‘wp_headers’, ‘wpse_289493’, 10, 2);

WordPress not seeing .htaccess rules

apache “AllowOverride” was set “None” but changing it to “All” made no effect : I changed the “AllowOverride” in the “apache2.conf” file. It’s still not clear where exactly you are setting AllowOverride. This directive can only be used in a directory context. ie. Inside a <Directory> container in your main server or VirtualHost config. You … Read more

301 Redirect domain Sub-folders to Subdomain subfolder

If both the main domain and subdomain point to the same directory on the filesystem, then you need to check the requested host using a mod_rewrite condition. So, for example, the following directives should go before the WordPress front-controller (ie. before the # BEGIN WordPress section): RewriteCond %{HTTP_HOST} ^(example\.com) [NC] RewriteRule ^(music/end/)$ http://music.%1/$1 [R=301,L] The … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)