Servers

Test if .htaccess Works with AllowOverride All

WP Ghost requires a working .htaccess file on Apache and LiteSpeed servers. If WP Ghost’s custom paths return 404 errors or your site doesn’t respond to path changes, the most common cause is that Apache isn’t processing .htaccess files. This guide provides two quick tests to diagnose the issue and shows you how to fix it by enabling AllowOverride All.

Test 1: Is Apache Reading .htaccess?

The fastest way to test whether Apache is reading your .htaccess file is to break it intentionally. If Apache reads the file, a syntax error in .htaccess triggers a 500 Internal Server Error. If Apache ignores the file, nothing happens.

  1. Open your .htaccess file via FTP, File Manager, or SSH.
  2. Add Test. as the very first line (this is intentionally invalid syntax):
Test.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
...
  1. Visit your site in a browser.

If you see a 500 Internal Server Error: Apache is reading the .htaccess file. This is good. Remove the Test. line immediately and proceed to Test 2.

If your site loads normally: Apache is ignoring the .htaccess file. This means AllowOverride is set to None in your Apache config. Skip to the How to Fix section below.

Remove the Test. line immediately after the test. Leaving it in place keeps your site in a 500 error state. This test is meant to be temporary – add the line, check the result, remove the line.

Test 2: Is mod_rewrite Working?

If Test 1 confirmed Apache reads .htaccess, the next step is to verify that mod_rewrite (the rewrite module WP Ghost uses) is enabled and working.

  1. Temporarily replace the contents of your .htaccess with this test rule:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^test$ /redirected [R=302,L]
</IfModule>
  1. Visit http://yourdomain.com/test in your browser.
  2. If the URL changes to /redirected: mod_rewrite is working. Remove the test rule and restore your original .htaccess. WP Ghost should work normally.
  3. If nothing happens: mod_rewrite is not enabled. Enable it with sudo a2enmod rewrite and restart Apache.

Restore your original .htaccess after testing. Back up your original .htaccess before running this test. The test rule replaces all content temporarily. Restore the original file when done.

How to Fix .htaccess Not Working

If Apache is ignoring your .htaccess file, you need to enable AllowOverride All in the Apache configuration.

Option 1: Edit Apache Config via SSH

If you have SSH access to your server:

  1. Open the Apache config file (location depends on your distribution):
# Ubuntu/Debian
sudo nano /etc/apache2/apache2.conf

# CentOS/RHEL/Rocky/Alma
sudo nano /etc/httpd/conf/httpd.conf
  1. Find the <Directory> block for your web root and change AllowOverride None to AllowOverride All:
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  1. Save the file, test the config, and restart Apache:
# Test syntax
sudo apache2ctl configtest    # Ubuntu/Debian
sudo httpd -t                 # CentOS/RHEL

# Restart
sudo systemctl restart apache2   # Ubuntu/Debian
sudo systemctl restart httpd     # CentOS/RHEL

For the full guide with additional details, see Set AllowOverride All on Apache.

Option 2: Contact Hosting Support

If you’re on shared hosting without SSH access, contact your hosting provider and ask them to enable AllowOverride All for your site’s directory. Most hosting providers (SiteGround, Bluehost, HostGator, A2 Hosting) already have this enabled. If they don’t, they can enable it through their server configuration. Some hosting panels (cPanel, Plesk, DirectAdmin) also have options to configure this without SSH.

Frequently Asked Questions

Does this apply to Nginx?

No. Nginx doesn’t use .htaccess files. If you’re on Nginx, see the Setup WP Ghost on Nginx Server guide for the correct configuration approach.

Yes. WordPress permalinks depend on .htaccess rewrite rules too. If your permalinks show 404 errors, it confirms AllowOverride is set to None. Fixing it for WP Ghost also fixes WordPress permalinks.

Does this apply to LiteSpeed servers?

LiteSpeed reads .htaccess files automatically and supports mod_rewrite rules natively. If WP Ghost’s paths aren’t working on LiteSpeed, the issue is more likely related to the LiteSpeed-specific .htaccess syntax support. See Configure .htaccess in OpenLiteSpeed for LiteSpeed-specific guidance.

Does WP Ghost modify WordPress core files?

No. WP Ghost writes rewrite rules to .htaccess and uses WordPress hooks for application-level changes. No core files are modified.

Apache and .htaccess configuration:

John Darrel

Change the WordPress Database Prefix for Security

Replace the default wp_ database prefix with a random one to protect against SQL injection…

1 year

Customize WordPress Uploads Directory | WP Ghost

Change the WordPress uploads directory path with WP Ghost (rewrite rules, no files moved) or…

1 year

WP Ghost and WP Rocket Cache Setup Guide

Configure WP Ghost with WP Rocket cache. Enable file optimization, Change Paths in Cache Files.…

1 year

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

1 year

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

1 year

Set Up WordPress 2FA with Mobile Authenticator Apps

Step-by-step guides to connect WP Ghost 2FA with Google Authenticator, Authy, Microsoft Authenticator, or LastPass.…

1 year