Skip to contentSkip to main navigation Skip to footer

Setup Hide My WP on Amazon AWS Lightsail

Apache version on AWS Lightsail WordPress

Step1: Install, Setup Hide My WP Ghost Plugin and click the Save button with the new paths.

Step2: Copy the rewrite rules from Hide My WP Ghost into Bitnamy config file

AWS Lightsail (Bitnami) doesn’t enable overrides using .htaccess by default and the structure of the Apache config files is a bit different.

Bitnami uses “htaccess.conf” files by default instead of “.htaccess” files for security and performance reasons. You can find more info at https://docs.bitnami.com/general/apps/redmine/administration/use-htaccess/

If you found the config file (it’s usually located at /home/bitnami/apps/wordpress/conf/httpd-app.conf) you should see something like the following code.  Add the code generated by WordPress in the .htaccess file

<Directory "/opt/bitnami/apps/wordpress/htdocs">
 Options +MultiViews +FollowSymLinks
 AllowOverride None 

 # Example of Hide My WP Ghost code generated. Change it with the real code
 RewriteRule ^([_0-9a-zA-Z-]+/)?admin/ajax(.*) /wordpress/wp-admin/admin-ajax.php$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?admin/(.*) /wordpress/wp-admin/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?login(.*) /wordpress/wp-login.php$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?login/(.*) /wordpress/wp-login.php$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?modules/(.*) /wordpress/wp-content/plugins/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?assets/(.*) /wordpress/wp-content/themes/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?storage/(.*) /wordpress/wp-content/uploads/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?core/(.*) /wordpress/wp-content/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?lib/(.*) /wordpress/wp-includes/$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?comments/(.*) /wordpress/wp-comments-post.php$2 [QSA,L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?writer/(.*) /wordpress/author/$2 [QSA,L]

 #####################################
 #This is the code from your .htaccess file where the wordpress is installed
 RewriteEngine On
 RewriteBase /wordpress/
 RewriteRule ^index\.php$ - [S=1]

 
 # end of Hide My WordPress Ghost code
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /wordpress/index.php [L]
 ############################################################### End of WordPress code

 <IfDefine USE_PHP_FPM>
  <FilesMatch \.php>
   SetHandler "proxy:fcgi://wordpress-fpm/"
  </FilesMatch>
 </IfDefine>

</Directory>

If it is easier for you, you can enable “.htaccess”. In order to enable “.htaccess” you should add “Allow Override” to your Directories configuration in your VirtualHosts (not in the VirtualHosts directly).

What you have to do is to change from AllowOverride None to AllowOverride All 

The VirtualHost configuration should be something like this:

<Directory "/opt/bitnami/apps/wordpress/htdocs">
 Options +MultiViews +FollowSymLinks
 AllowOverride All

 <IfDefine USE_PHP_FPM>
 <FilesMatch \.php >
   SetHandler "proxy:fcgi://wordpress-fpm/"
 </FilesMatch>
 </IfDefine>

</Directory>

Step3: Now restart the Apache server and it should work.

sudo /opt/bitnami/ctlscript.sh restart apache

You can read more about it at https://community.bitnami.com/t/wordpress-htaccess-permissions-override-on-ami/24408/5