Webstat page redirects to domain's main page or shows 404 not found error

Created:

2016-12-12 03:42:50 UTC

Modified:

2017-08-16 18:34:36 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Webstat page redirects to domain's main page or shows 404 not found error

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux

Symptoms

Unable to access domain's web statistics page at https://www.example.com/plesk-stat/webstat/ : it get redirected to domain main page, or shows error:

404 not found

The following nginx directive is defined in Domains > example.com > Apache and nginx Settings :

if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}

or:

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

PHP handler is set to FPM by Nginx

Cause

Additional nginx directives interfere with accessing Web Statistics

Resolution

Replace the additional directive with the following:

if (!-e $request_filename ){
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon)){
set $test "${test}C";
}
if ($test = PC){
rewrite ^ /server/index.php last;
}

If the directive above fixes the issue with Web Statistics page, but makes some links on a site broken, use the following additional directives instead:

if (!-e $request_filename ){
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon)){
set $test "${test}C";
}
if ($test = PC){
rewrite ^/(.*)$ /index.php?q=$1 last;
}

If additional directives are not required for website functioning, remove them in Domains > example.com > Apache and nginx Settings .

Have more questions? Submit a request
Please sign in to leave a comment.