• Resolved jscooper

    (@jscooper)


    Hi,
    
    I followed (I think) the nginx rewrite settings and it’s still not working.
    
    It’s for a company intranet on a server that hosts a couple other sites. The lite version seems to be v2.8.4 and I’ve tried both:
    
    rewrite wp-content/uploads/(.+)(\.)([A-Za-z0-9]+)$ "/index.php?pre_dir_acc_61co625547=$1&is_direct_access=true&file_type=$3" last;
    rewrite private/([a-zA-Z0-9-_]+)$ "/index.php?pre_dir_acc_61co625547=$1&custom_181191=$2" last;
    
    and?
    
    rewrite subdomain.domain.com/wp-content/uploads/(.+)(\.)([A-Za-z0-9]+)$ "/index.php?pre_dir_acc_61co625547=$1&is_direct_access=true&file_type=$3" last;
    rewrite subdomain.domain/private/([a-zA-Z0-9-_]+)$ "/index.php?pre_dir_acc_61co625547=$1&custom_181191=$2" last;
    
    in both the intranet subdomain and default config files. Per the instructions, I put the above code inside the server block but outside all the location blocks.
    
    I could be that regex just makes my head hurt but I couldn’t find a way to make the page load correctly at all. When the plugin is activated, users cannot use the site and just get a "Nothing Found" message.
    
    Thanks,
    
    Jeff
Viewing 1 replies (of 1 total)
  • Plugin Author BWPS Team

    (@buildwps)

    Hi Jscooper,

    Thank you for reaching out to us.

    The rewrite rule you are using is for the PDA Gold which can make it won’t work.

    Could you try to use this Rewrite Rules and follow the steps below and check if it works please?

    1.Copy the rewrite rules shown on Prevent Direct Access settings page

    2. Find your website’s Nginx config file which is often located at /etc/nginx/site-available or /etc/nginx/conf/site-available (if you’re using Arch Linux)
    3. Paste the copied rules in the server block

    server {
    	location / {
    		...
    	}
    	#Put our rewrite rules here, i.e.
    rewrite wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ "/index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2" last;
    rewrite private/([a-zA-Z0-9-_.]+)$ "/index.php?pda_v3_pf=$1" last;
    }

    4. Restart your Nginx server.

    References: https://preventdirectaccess.com/docs/prevent-direct-access-lite/#nginx

    You might also want to drop us an email at support(at)wpfolio.com so that our team can support you faster, 

    • This reply was modified 1 year, 6 months ago by BWPS Team.
Viewing 1 replies (of 1 total)
  • The topic ‘nginx rewrite not working’ is closed to new replies.