[How To] Set Hide My Wp Ghost For Bitnami Servers

#1 Bitnami Setup for Apache Servers

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

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 WordPress 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
gt;
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
gt;
SetHandler "proxy:fcgi://wordpress-fpm/"
</FilesMatch>
</IfDefine></Directory> 

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

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

#2 Bitnami Setup for Nginx Servers

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

Step2: Copy the config path line for Nginx.

Bitnami Config File Hide My WP

The nginx config file it’s usually located at /home/bitnami/apps/wordpress/conf/httpd-app.conf. You should see something like the following code.

index index.php index.html index.htm;

#paste the hidemywp.conf line here:
include /opt/bitnami/apps/wordpress/htdocs/hidemywp.conf;

if ($request_uri !~ "^/phpmyadmin.*$")
{
  set $test  A;
}
if ($request_uri !~ "^/bitnami.*$")
{
  set $test  "${test}B";
}
if (!-e $request_filename)
{
  set $test  "${test}C";
}
if ($test = ABC) {
  rewrite ^/(.+)$ /index.php?q=$1 last;
}

# Deny access to any files with a .php extension in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
  deny all;
}

# Disable logging for not found files and access log for the favicon and robots
location = /favicon.ico {
    log_not_found off;
    access_log off;
}
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

include "/opt/bitnami/apps/bitnami/banner/conf/banner-substitutions.conf";
include "/opt/bitnami/apps/bitnami/banner/conf/banner.conf";

Step3: Copy the Safe URL and click to relogin to your website. You will notice that new login page will not be found.

Step4: Restart the Nginx config through SSH or SFTP to activate the new paths. Command line:  sudo nginx -s reload

0 Comments

There are no comments yet

Leave a comment

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