Multisite Network

Our plugins require .htaccess modification in order to work properly on Apache. We can update the rules automatically for you once the plugins are activated on WordPress single site but not multisite network.

In this article, we’ll show you how to configure .htaccess rules manually in the multisite mode for our plugins to work properly.

Prevent Direct Access (PDA) Gold

Once activating plugin and entering license key successfully, you will be redirected to our Helpers tab as per the screenshot below.

Simply copy and paste the following rules into your .htaccess file located in the WordPress root directory.

Rewrite rules for Apache Single site

# Prevent Direct Access Rewrite Rules
RewriteRule ^(?:[_0-9a-zA-Z-]+/)?private/([a-zA-Z0-9-_]+)$ index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy [L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Twitterbot/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Googlebot/[0-9]
RewriteRule ^wp-content/uploads(?:/sites/[0-9]+)?(/_pda/.*\.\w+)$ index.php?pda_v3_pf=$1 [L]
# Prevent Direct Access Rewrite Rules End
You should insert our rewrite rules right above the line “RewriteCond %{REQUEST_FILENAME} -f [OR]”

Rewrite rules for NGINX Multisite site

rewrite wp-content/uploads(?:/sites/[0-9]+)?(/_pda/.*\.\w+)$ "/index.php?pda_v3_pf=$1" last;
rewrite (?:[_0-9a-zA-Z-]+/)?private/([a-zA-Z0-9-_.]+)$ "/index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy" last;

After that, go back to the plugin’s Settings page and click on “Check rewrite rules” button to determine if the rules are configured correctly.

It’s important to know that if you use PDA Gold 3-site or 10-site license, you have to install and activate PDA Multisite extension before inserting rules.

Without PDA Multisite extension, these types of PDA Gold can’t detect if the rules are inserted correctly or not. So you’ll receive the error message during the checking rewrite rules process.

Change Download Link Prefix

This option under PDA Gold settings page allows you to change “private” prefix of your download links. To achieve it in WordPress network, you need to change the term “private” in our rewrite rules to which you have inserted into this field.

For example, you customize the default value to “member”.

So the rewrite rule should be like below:

RewriteRule ^(?:[_0-9a-zA-Z-]+/)?member/([a-zA-Z0-9-_]+)$ index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy [L] RewriteCond %{REQUEST_FILENAME} -s

Please note that this configuration is applied for whole your network, including both main and subsites. So our plugin enable you to customize it from the main site only to avoid potential conflicts. The “Change Download Link Prefix” will be disabled in subsites by default.

Protect WordPress Pages & Posts (PPP) Gold

Since version 2.0.0, PPP is able to work properly with any hosting server without extra configuration. The following guides are for older versions.

Apache Server

After installing and entering your license key successfully, go to your .htaccess file in the WordPress root folder and insert the following rule:

# Protect Pages & Post Rewrite Rules
RewriteRule ^(?:[_0-9a-zA-Z-]+/)?privatepup/.+/([a-zA-Z0-9-_]+)$ index.php?pre_endpoint_pup=$1 [L]
# Protect Pages & Post Rewrite Rules End
You should insert our rewrite rules right after the line “RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]”

Change Access Link Prefix

This option under PPP Gold settings page allows you to change “private” prefix of your access links. To achieve it in WordPress network, you need to change the term “privatepup” in our rewrite rule to which you have inserted to this field.

For example, you customize the default value to “member”.

So the rewrite rule should be like below:

RewriteRule ^(?:[_0-9a-zA-Z-]+/)?member/.+/([a-zA-Z0-9-_]+)$ index.php?pre_endpoint_pup=$1 [L]

Nginx Server

Since Nginx does not have a directory-level configuration file like Apache’s .htaccess, PPP Gold cannot modify and update the server configuration automatically for you. So you need to implement our rewrite rules manually for PPP to work properly in Nginx.

Step 1: Find and open your website’s Nginx config file which is normally located at /etc/nginx/site-available (or /etc/nginx/conf/site-available if you’re using Arch Linux)

Step 2: Copy the following rewrite rules and then put it inside the server block

rewrite privatepup/([a-zA-Z0-9-_]+)$ "index.php?pre_endpoint_pup=$1" last;

server {

    location / {
     ...
    }

   #Put our rewrite rules here, i.e.
   rewrite privatepup/([a-zA-Z0-9-_]+)$ "index.php?pre_endpoint_pup=$1" last;
}

Step 3: Restart your Nginx server, our PPP Gold should work as normal on your website

Lasted updated on June 9, 2021