[How To] Enable AllowOverwrite on Google Cloud Platform

If you deploy a WordPress website on Google Cloud Hosting you should know that the AllowOverwrite is None by default and you can’t use the .htaccess for caching and security filters.

In order to make Hide My WP Ghost work on Google Cloud Platform just follow the next steps to activate the rewrite rules:

Enable mod_rewrite in Apache

There are many ways to enable mod_rewrite in case it’s not yet enabled by Google Cloud. You can find some answers here: How to enable mod_rewrite for Apache 2.2.

It’s not hard to setup the Apache on Google. All you need to do is to access the SSH built into your Google Cloud Platform Deployment Manager and follow the command-line actions. 

Once you click on SSH button, the Google SSH console will load. To check if mod_rewrite is enabled in apache run this command: 

$: a2enmod rewrite

Enable Apache AllowOverride

To enable the .htaccess rewrites, you need to edit /etc/apache2/apache2.conf and make sure that it is configured with AllowOverride All instead of the default AllowOverride None for your web root directory. This tells apache it is ok for settings in .htaccess files to override settings. Use this command to modify the file.

sudo nano /etc/apache2/apache2.conf

Once you’re in there, find the right spot and change it.


<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride ALL <----(edit from none)
        Require all granted
</Directory>

Save the file changes with Ctrl + X and then press Y .

After you’ve made that change, make sure to restart the server:

sudo service apache2 restart

Now, your .htaccessshould work and you can use caching and security filters and also activate Hide My WP Ghost to hide the WordPress common paths.

0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.