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.
The AllowOverride directive controls which Apache directives can be overridden by .htaccess files in a directory. When set to None (the default for security reasons), Apache completely ignores .htaccess files. When set to All, Apache reads and applies any directive found in .htaccess, including rewrite rules, authentication, file restrictions, and Options. WordPress requires this for pretty permalinks, plugins like WP Ghost require it for path security rules, and cache plugins require it to write performance rules.
On Ubuntu and Debian, the Apache configuration file is /etc/apache2/apache2.conf. The web root is typically /var/www/.
sudo nano /etc/apache2/apache2.conf <Directory /var/www/> block. It looks like this:<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory> AllowOverride None to AllowOverride All:<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory> Ctrl+O, Enter, Ctrl+X).sudo a2enmod rewrite sudo systemctl restart apache2 Older Ubuntu versions: If systemctl isn’t available (Ubuntu 14.04 and earlier), use sudo service apache2 restart instead.
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.
sudo nano /etc/httpd/conf/httpd.conf <Directory "/var/www/html"> block. It looks like this:<Directory "/var/www/html">
AllowOverride None
</Directory> AllowOverride None to AllowOverride All:<Directory "/var/www/html">
AllowOverride All
</Directory> sudo httpd -t If you see Syntax OK, proceed to restart. If you see errors, fix them before restarting.
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.
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.
.htaccess in your WordPress root directory.InvalidDirectiveFor a complete verification guide, see Make Sure .htaccess Is Working with AllowOverride All.
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:
AllowOverride All is set for your WordPress directory.sudo a2enmod rewrite on Ubuntu).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.
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.
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.
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.
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.
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.
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.
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.
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:
Replace the default wp_ database prefix with a random one to protect against SQL injection…
Change the WordPress uploads directory path with WP Ghost (rewrite rules, no files moved) or…
Configure WP Ghost with WP Rocket cache. Enable file optimization, Change Paths in Cache Files.…
https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…
The security of your WordPress site depends on multiple factors, such as the strength of…
Step-by-step guides to connect WP Ghost 2FA with Google Authenticator, Authy, Microsoft Authenticator, or LastPass.…