We have a Wordpress website serving some PDFs to logged in members. For that to be possible, the hosting company has a rule in nginx and we have to place the protected files in wp-content/uploads/membersonly
set $is_uri 0;
set $is_logged 0;
if ( $request_uri ~* "wp-content/uploads/membersonly" ) {
set $is_uri 1;
}
if ($http_cookie ~ "wordpress_logged_in") {
set $is_logged 1;
}
set $conditional "$is_uri:$is_logged";
if ($conditional = "1:0") {
return 403;
break;
}
We don't have access to the nginx configuration, I believe it's a shared hosting, but we would like to customize that 403 page. Right now it looks like the server it's broken. It would be nice to have something like
Content restricted
This content is only available to members
Login or Register
That's impossible because - like I said - we don't have access to nginx config and folder and htaccess cannot control that either. I tried to add
ErrorDocument 403 /mycustom403.php
to .htaccess but nothing happens, I still see the uggly 403 error page
Is there anything I can do to customize it?
For nginx server .htaccess file will not work. It will only works for apache server. For nginx server you have to create custom config file for your domain name.