How to Check If .htaccess Is Working with AllowOverride All for WordPress

Moved

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.

View on new site

WP Ghost needs .htaccess and mod_rewrite to work on Apache servers. Test both with the methods below, and if they are not enabled, set AllowOverride All in your Apache configuration.

Why This Matters for WP Ghost

WP Ghost writes its path security and firewall rules directly into the .htaccess file on Apache and LiteSpeed servers. If your server ignores .htaccess or does not have mod_rewrite enabled, none of these rules will take effect. Your paths will not change, the firewall will not filter requests, and your site will remain exposed to bot scans.

Before troubleshooting any WP Ghost issue on an Apache server, confirm that .htaccess is working and mod_rewrite is enabled. It takes less than a minute to test both.

Test If .htaccess Is Working

The fastest way to test if Apache is reading your .htaccess file is to intentionally break it. If the server reacts to the broken file, it means .htaccess is active.

1. Connect to your server using sFTP or your hosting File Manager.

2. Open the .htaccess file in your WordPress root directory.

3. Add the word Test. as the very first line, above everything else:

Test.

# Set the default handler
DirectoryIndex index.php index.html index.htm

...

4. Save the file and refresh your website in the browser.

5. Check the result:

If you see an Internal Server Error (500) – that is actually good. It means Apache is reading the .htaccess file and it choked on the invalid line we added. Your .htaccess is working. Remove the “Test.” line to restore your site.

Internal Server Error 500 confirming .htaccess is being read by Apache

If your site loads normally with no error – Apache is ignoring the .htaccess file. This usually happens because the Apache configuration has AllowOverride None set. You need to fix this before WP Ghost (or WordPress permalinks) will work correctly.

Test If mod_rewrite Is Working

Even if .htaccess is active, the mod_rewrite module must be enabled for WP Ghost’s rewrite rules to function. Here is how to test it.

1. Replace the entire contents of your .htaccess file with this test rule:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^.*$ /redirected
</IfModule>

2. In your browser, visit http://yourdomain.com/test.

3. Check the result:

If the URL redirects to http://yourdomain.com/redirected – mod_rewrite is working correctly. Restore your original .htaccess content immediately.

If nothing happens or you get a 404 – mod_rewrite is not enabled. Contact your hosting provider to enable it, or enable it yourself if you have server access (see below).

Important: Restore your original .htaccess content immediately after testing. The test rule redirects every request on your site, so your site will be inaccessible until you restore it. If you are not sure what the original content was, you can regenerate it by going to WordPress > Settings > Permalinks and clicking Save Changes.

How to Fix .htaccess If It Is Not Working

The most common reason Apache ignores .htaccess is the AllowOverride None directive in the server configuration. You need to change it to AllowOverride All.

If You Have Server Access (VPS, Dedicated, or Self-Hosted)

1. Open your Apache configuration file. Depending on your setup, this is typically at one of these locations: /etc/apache2/apache2.conf, /etc/httpd/conf/httpd.conf, or inside a virtual host file in /etc/apache2/sites-available/.

2. Find the <Directory> block that points to your WordPress installation:

<Directory "/var/www/htdocs">
    AllowOverride None

3. Change AllowOverride None to:

    AllowOverride All

The full block should look like this:

<Directory /var/www/site/example.com/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

4. Save the file and restart Apache:

sudo systemctl restart apache2

or on CentOS/RHEL:

sudo systemctl restart httpd

5. Run the .htaccess test again to confirm it is now working.

For a detailed guide on setting AllowOverride on specific server types, see How to Set AllowOverride All.

If You Are on Shared Hosting

On shared hosting, you typically do not have access to the Apache configuration file. Check your hosting control panel (cPanel, Plesk, DirectAdmin) for an option to enable .htaccess or mod_rewrite. If you can not find it, contact your hosting provider and ask them to set AllowOverride All for your website directory.

Most reputable WordPress hosting providers already have AllowOverride All enabled by default. If yours does not, it may be worth considering a host that does.

After Fixing .htaccess

Once .htaccess and mod_rewrite are confirmed working, go to your WP Ghost settings and click Save. This rebuilds all the rewrite rules with your current configuration. Then run a Security Check to verify everything is applied correctly.

If you are using an Nginx server instead of Apache, WP Ghost works differently. See the Nginx Server Setup guide for instructions.

Frequently Asked Questions

Does WP Ghost require .htaccess to work?

On Apache and LiteSpeed servers, yes. WP Ghost writes its path security and firewall rules to .htaccess. On Nginx servers, WP Ghost uses a separate configuration approach. On IIS servers, it uses web.config. The plugin detects your server type automatically.

Will changing AllowOverride affect other things on my server?

AllowOverride All enables .htaccess processing for the specified directory. This is required for WordPress permalinks, WP Ghost, and many other plugins to function correctly. It is the standard setting for WordPress on Apache and is safe to enable.

WP Ghost paths are not changing after saving. What is wrong?

The most common cause is that .htaccess is not being read by Apache. Run the test described above. If .htaccess is not working, enable AllowOverride All and restart Apache. If .htaccess is working but paths still do not change, check that your .htaccess file is writable (permission 644) and that no other plugin is overwriting WP Ghost’s rules.

I accidentally broke my site with the .htaccess test. How do I fix it?

Connect to your server via sFTP or File Manager and remove the “Test.” line from .htaccess. Your site will work again immediately. If you replaced the entire .htaccess content with the mod_rewrite test, you can regenerate the default WordPress rules by going to Settings > Permalinks and clicking Save Changes, then saving WP Ghost settings again to rebuild its rules.

Does WP Ghost modify WordPress core files?

No. WP Ghost writes rewrite rules to .htaccess (on Apache/LiteSpeed) or config files (on Nginx) and uses WordPress hooks. No WordPress core files are moved, renamed, or modified. Deactivating the plugin restores all default paths instantly.