How to Enable AllowOverride on Google Cloud Platform for WP Ghost
August 6, 2019

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.
- Why Google Cloud Needs This Setup
- How to Configure Google Cloud for WP Ghost
- Troubleshooting
- Frequently Asked Questions
- Is this a one-time setup?
- Does this apply to other cloud platforms like AWS, Azure, or DigitalOcean?
- What if my Google Cloud instance uses Nginx instead of Apache?
- Will changing AllowOverride affect other parts of my site?
- How do I check if AllowOverride is already set correctly?
- Does WP Ghost modify WordPress core files?
- Related Tutorials
Enable AllowOverride and mod_rewrite on Google Cloud Platform so WP Ghost (formerly Hide My WP Ghost) can write .htaccess rewrite rules. Google Cloud’s default WordPress deployment sets AllowOverride None, which means .htaccess files are ignored. This is a one-time server configuration step via SSH. After it is done, WP Ghost works normally.
Why Google Cloud Needs This Setup
Google Cloud’s WordPress images (via Deployment Manager or Marketplace) use Apache with AllowOverride None as the default. This is a security-conservative default that prevents .htaccess files from overriding server configuration. WordPress itself, most cache plugins, and WP Ghost all depend on .htaccess rewrite rules. Without AllowOverride All, WordPress permalinks, caching rules, and WP Ghost’s path security rules are all ignored by Apache.
How to Configure Google Cloud for WP Ghost
Step 1: Enable mod_rewrite in Apache
SSH into your Google Cloud instance. In the Google Cloud Console, navigate to your VM instance and click the SSH button to open the terminal.

Run this command to enable the Apache rewrite module:
sudo a2enmod rewriteIf mod_rewrite is already enabled, the command will tell you. No harm in running it either way.
Step 2: Set AllowOverride All
Edit the Apache configuration file:
sudo nano /etc/apache2/apache2.confFind the <Directory /var/www/> block and change AllowOverride None to AllowOverride All:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save the file with Ctrl + X, then press Y to confirm, then Enter.
Step 3: Restart Apache and Test
Test the configuration for syntax errors first:
sudo apache2ctl configtestIf it returns Syntax OK, restart Apache:
sudo service apache2 restartYour .htaccess file is now active. Activate WP Ghost in Safe Mode or Ghost Mode from WP Ghost > Change Paths > Level of Security. Run the Frontend Login Test to confirm everything is working.
Troubleshooting
Custom paths return 404 after enabling WP Ghost
Verify AllowOverride All is set for the correct directory in /etc/apache2/apache2.conf. Run sudo apache2ctl configtest to check for syntax errors. Confirm mod_rewrite is enabled by running apache2ctl -M | grep rewrite. Restart Apache after any changes.
Apache will not restart after editing config
There is a syntax error in apache2.conf. Run sudo apache2ctl configtest to see the specific error and line number. Common causes include unclosed <Directory> tags, extra characters, or editing the wrong block. Fix the error and try restarting again.
WordPress permalinks also not working
This confirms AllowOverride is still set to None. WordPress permalinks depend on .htaccess rewrite rules too. Once you set AllowOverride All and restart Apache, both WordPress permalinks and WP Ghost custom paths will work.
Locked out after configuration
SSH back into your Google Cloud instance and either fix the Apache config or use the Safe URL parameter to bypass WP Ghost temporarily. If that does not work, see the Emergency Disable guide to deactivate WP Ghost via SSH/SFTP.
Frequently Asked Questions
Is this a one-time setup?
Yes. Once mod_rewrite is enabled and AllowOverride All is set, the configuration persists across Apache restarts. You do not need to repeat these steps. After this setup, WP Ghost writes to .htaccess automatically like any standard Apache server.
Does this apply to other cloud platforms like AWS, Azure, or DigitalOcean?
The same issue can occur on any cloud platform whose WordPress image defaults to AllowOverride None. The fix is identical: enable mod_rewrite, set AllowOverride All, restart Apache. The exact config file path may differ by Linux distribution. See the Set AllowOverride All on Apache guide for distribution-specific paths.
What if my Google Cloud instance uses Nginx instead of Apache?
This guide is for Apache-based deployments only. If your Google Cloud instance runs Nginx, follow the Nginx server setup guide instead. You can check your web server by running apachectl -v (Apache) or nginx -v (Nginx) via SSH.
Will changing AllowOverride affect other parts of my site?
AllowOverride All enables .htaccess processing for your entire web root. This is the standard configuration for any WordPress site and is required for WordPress permalinks, caching plugins, and security plugins to function. It does not introduce any security risk on its own.
How do I check if AllowOverride is already set correctly?
Run grep -n “AllowOverride” /etc/apache2/apache2.conf via SSH. This shows every AllowOverride directive and its line number. Look for the one inside the <Directory /var/www/> block. If it says “All”, your configuration is already correct.
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. Deactivating WP Ghost restores all defaults instantly.
Related Tutorials
Set AllowOverride All on Apache – general Apache guide with distribution-specific paths.
Nginx Server Setup – configuration for Nginx-based deployments.
Theme Not Loading Correctly – troubleshoot path issues on different server types.
Advanced Settings – Safe URL parameter and recovery options.
Customize All WordPress Paths – start configuring WP Ghost after server setup is complete.