Plugins

WP Ghost and Advanced Access Manager Compatibility

WP Ghost is compatible with Advanced Access Manager (AAM) with one adjustment. AAM is a user access management plugin that controls backend access rights, restricts content by user role, and protects media files from unauthorized access. AAM’s media file protection uses .htaccess rewrite rules that reference wp-content/uploads. When WP Ghost changes the uploads path, you need to update AAM’s rewrite rules to match. This is a one-time edit.

Why AAM Needs WP Ghost Configuration

AAM’s media file protection feature adds rewrite rules to .htaccess that intercept requests to files in wp-content/uploads. These rules check whether the current user has permission to access the requested file. When WP Ghost changes the uploads path (for example, from wp-content/uploads to storage), AAM’s rules stop matching because they still reference the original path. The fix is to update the path in AAM’s .htaccess rules to match your WP Ghost custom uploads path.

Update the AAM .htaccess Rules

AAM adds the following rewrite rules to your .htaccess file to protect media uploads. You need to change the wp-content/uploads path to match your WP Ghost custom uploads path.

Original AAM rules (default WordPress uploads path):

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_URI} \.(jpg|jpeg|png|svg|gif|ico|pdf|doc|docx|ppt|pptx|pps|ppsx|odt|xls|xlsx|psd)$
    RewriteCond %{REQUEST_URI} wp-content/uploads/(.*)$
    RewriteRule . /index.php?aam-media=1 [L]
</IfModule>

Updated rules (with your WP Ghost custom uploads path):

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_URI} \.(jpg|jpeg|png|svg|gif|ico|pdf|doc|docx|ppt|pptx|pps|ppsx|odt|xls|xlsx|psd)$
    RewriteCond %{REQUEST_URI} storage/(.*)$
    RewriteRule . /index.php?aam-media=1 [L]
</IfModule>

Replace storage with whatever custom uploads path you set in WP Ghost > Change Paths > WP Core Security. For example, if your custom uploads path is media, use media/(.*)$ instead.

To make this change:

  1. Open your .htaccess file via FTP, File Manager, or SSH.
  2. Find the AAM rewrite block (starts with # BEGIN AAM or the <IfModule mod_rewrite.c> block containing aam-media=1).
  3. Replace wp-content/uploads with your custom WP Ghost uploads path.
  4. Save the file.

Important: If you change your WP Ghost uploads path later, you need to update the AAM .htaccess rules again to match. This is a manual step – WP Ghost doesn’t automatically update third-party rewrite rules.

Apache and LiteSpeed only. This .htaccess adjustment only applies to Apache and LiteSpeed servers. Nginx doesn’t use .htaccess files, so AAM’s media protection on Nginx requires a different configuration (check AAM’s documentation for Nginx-specific rules).

Verify the Setup

  1. Log out of WordPress or open an incognito window.
  2. Try to access a media file that AAM should be restricting (a file limited to specific user roles).
  3. Confirm you get a 403 Forbidden or redirect instead of the file content.
  4. Log in as a user with permission and confirm you can access the same file.
  5. Check the page source to confirm WP Ghost is still showing custom paths (search for wp-content/uploads – it should NOT appear).

Troubleshooting

Restricted media files are accessible to everyone

AAM’s rewrite rule isn’t matching your custom uploads path. Open .htaccess and confirm the path in the RewriteCond line matches exactly what WP Ghost is using. Check the exact path at WP Ghost > Change Paths > WP Core Security > Custom uploads Path.

Media files return 404 errors

The AAM rewrite rule may be conflicting with WP Ghost’s rewrite rules. Check the order of rules in .htaccess – the AAM block should be placed after WP Ghost’s rules. Re-save WP Ghost settings to restore the correct rule order if needed.

AAM media protection stopped working after changing WP Ghost paths

You changed your WP Ghost uploads path but didn’t update the AAM .htaccess rules. Open .htaccess, find the AAM block, and update the path to match your new custom uploads path.

Locked out after configuration

Use the Safe URL parameter to bypass WP Ghost temporarily. If that doesn’t work, see the Emergency Disable guide to recover access via FTP.

Frequently Asked Questions

Do other AAM features need adjustments?

No. The only AAM feature that needs adjustment is the media file protection (the .htaccess rewrite rules for uploads). AAM’s user role management, content access control, backend restrictions, and other features work with WP Ghost without any changes.

Will WP Ghost update the AAM rules automatically?

No. WP Ghost only manages its own rewrite rules. Third-party plugin rules in .htaccess need to be updated manually when you change WP Ghost paths. This is a one-time adjustment unless you change your uploads path later.

Does WP Ghost modify WordPress core files?

No. WP Ghost writes rewrite rules to .htaccess (Apache) or hidemywp.conf (Nginx) and uses WordPress hooks for application-level changes. No core files are modified.

WP Ghost path configuration and compatibility:

John Darrel

Change the WordPress Database Prefix for Security

Replace the default wp_ database prefix with a random one to protect against SQL injection…

1 year

Customize WordPress Uploads Directory | WP Ghost

Change the WordPress uploads directory path with WP Ghost (rewrite rules, no files moved) or…

1 year

WP Ghost and WP Rocket Cache Setup Guide

Configure WP Ghost with WP Rocket cache. Enable file optimization, Change Paths in Cache Files.…

1 year

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

1 year

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

1 year

Set Up WordPress 2FA with Mobile Authenticator Apps

Step-by-step guides to connect WP Ghost 2FA with Google Authenticator, Authy, Microsoft Authenticator, or LastPass.…

1 year