Servers

Set AllowOverride All on Apache Servers Step by Step

Set AllowOverride All in your Apache configuration to enable .htaccess file processing for your WordPress directory. By default, many Apache installations have AllowOverride None, which causes Apache to ignore .htaccess files entirely – even if they exist in your site directory. WordPress, WP Ghost, and most security and caching plugins rely on .htaccess to write rewrite rules, redirects, and access controls. Without AllowOverride All, these rules silently fail. This guide shows the correct configuration for Ubuntu/Debian (apache2.conf) and CentOS/RHEL/Rocky/AlmaLinux (httpd.conf), with the verified restart commands.

What AllowOverride All Does

Ubuntu and Debian Servers

On Ubuntu and Debian, the Apache configuration file is /etc/apache2/apache2.conf. The web root is typically /var/www/.

  1. Open the configuration file with a text editor (you’ll need root privileges):
sudo nano /etc/apache2/apache2.conf
  1. Find the <Directory /var/www/> block. It looks like this:
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
  1. Change AllowOverride None to AllowOverride All:
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  1. Save the file (in nano: Ctrl+O, Enter, Ctrl+X).
  2. Enable the rewrite module if it isn’t already enabled:
sudo a2enmod rewrite
  1. Restart Apache to apply the changes:
sudo systemctl restart apache2

Older Ubuntu versions: If systemctl isn’t available (Ubuntu 14.04 and earlier), use sudo service apache2 restart instead.

CentOS, RHEL, Rocky, and AlmaLinux Servers

On CentOS, RHEL, Rocky Linux, and AlmaLinux, the Apache configuration file is /etc/httpd/conf/httpd.conf. The web root is typically /var/www/html.

  1. Open the configuration file with a text editor:
sudo nano /etc/httpd/conf/httpd.conf
  1. Find the <Directory "/var/www/html"> block. It looks like this:
<Directory "/var/www/html">
    AllowOverride None
</Directory>
  1. Change AllowOverride None to AllowOverride All:
<Directory "/var/www/html">
    AllowOverride All
</Directory>
  1. Save the file.
  2. Test the configuration syntax before restarting (catches typos that would crash Apache):
sudo httpd -t

If you see Syntax OK, proceed to restart. If you see errors, fix them before restarting.

  1. Restart Apache to apply the changes:
sudo systemctl restart httpd

CentOS 6 and earlier: Use sudo service httpd restart instead of systemctl.

Important: The directory path may differ on your server depending on your hosting setup. Check your virtual host configuration files in /etc/httpd/conf.d/ (CentOS/RHEL) or /etc/apache2/sites-enabled/ (Ubuntu/Debian) – the directive may need to be set in the virtual host file instead of the main config. The principle is the same: find the <Directory> block matching your site’s document root and change AllowOverride None to AllowOverride All.

Verify .htaccess Is Working

After changing AllowOverride and restarting Apache, verify that .htaccess is actually being read. The fastest method is to add an intentional syntax error to your .htaccess file – if .htaccess is being processed, you’ll get a 500 Internal Server Error. If you don’t get an error, .htaccess is still being ignored.

  1. Open .htaccess in your WordPress root directory.
  2. Add this line at the very top: InvalidDirective
  3. Visit your site. You should see a 500 Internal Server Error.
  4. If you see the error, .htaccess is working. Remove the test line and your site will work normally.
  5. If your site loads normally, .htaccess is being ignored – check that you saved the config file, restarted Apache, and the directive is in the correct directory block.

For a complete verification guide, see Make Sure .htaccess Is Working with AllowOverride All.

Why This Matters for WP Ghost

WP Ghost writes its rewrite rules to .htaccess on Apache servers. If AllowOverride None is set, WP Ghost’s rules are silently ignored. The plugin appears to save settings successfully, but custom paths return 404 errors and your default WordPress paths remain accessible.

Before installing WP Ghost on Apache:

  • Confirm AllowOverride All is set for your WordPress directory.
  • Verify the rewrite module is enabled (sudo a2enmod rewrite on Ubuntu).
  • Restart Apache after any config change.
  • Test that .htaccess is being read using the verification method above.

If you don’t have shell access to your server (managed hosting like SiteGround, Bluehost, GoDaddy), AllowOverride All is typically already set by default. Contact your hosting support if WP Ghost rules aren’t being applied.

Troubleshooting

Apache fails to restart with a syntax error

Run sudo apache2ctl configtest (Ubuntu) or sudo httpd -t (CentOS) to see the specific error and line number. Common issues: missing closing </Directory> tag, mismatched quotes, or typos in the directive name. Fix the error and try restarting again. Always test syntax before restarting on production servers.

.htaccess is still being ignored after AllowOverride All

The directive may be set in the wrong directory block. If your site lives in /var/www/example.com/public_html, the AllowOverride All needs to apply to that exact directory, not just /var/www/. Check your virtual host configuration in /etc/apache2/sites-enabled/ (Ubuntu) or /etc/httpd/conf.d/ (CentOS) and ensure there’s a matching <Directory> block with AllowOverride All.

500 Internal Server Error after enabling AllowOverride All

Your existing .htaccess file likely contains a directive that wasn’t being processed before but is now causing an error. Check the Apache error log: /var/log/apache2/error.log (Ubuntu) or /var/log/httpd/error_log (CentOS) for the specific error. Common causes include missing modules referenced in <IfModule> blocks or syntax errors in existing rewrite rules.

Rewrite rules don’t work even with AllowOverride All

The Apache rewrite module may not be enabled. On Ubuntu: sudo a2enmod rewrite && sudo systemctl restart apache2. On CentOS, the rewrite module is usually compiled in by default but you can verify with httpd -M | grep rewrite. You should see rewrite_module in the output.

Frequently Asked Questions

Why is AllowOverride None the default?

Performance and security. When AllowOverride is enabled, Apache must check every directory in the URL path for .htaccess files on every request, which adds overhead. Setting it to None by default also prevents users from accidentally enabling features that could compromise security through their .htaccess files. For WordPress sites, the convenience and functionality of .htaccess outweighs the small performance cost.

Do I need to do this on managed hosting?

No. Managed WordPress hosts (SiteGround, Bluehost, GoDaddy, WP Engine, Cloudways) typically have AllowOverride All enabled by default for WordPress directories. This guide is primarily for self-managed VPS, dedicated server, or local development environments.

Is AllowOverride All the same as AllowOverride Options?

No. AllowOverride All allows all directives in .htaccess. AllowOverride Options only allows the Options directive and nothing else. WordPress and WP Ghost need All to function properly because they use rewrite rules, file restrictions, and other directives.

What about Nginx?

Nginx doesn’t support .htaccess files at all. There’s no AllowOverride equivalent. On Nginx, rewrite rules must be added directly to the server configuration. See Setup WP Ghost on Nginx Server for the Nginx-specific configuration.

Server configuration for WP Ghost:

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