Primary script unknown error is logged while accessing non-existent file.

Created:

2016-12-12 03:43:59 UTC

Modified:

2017-08-08 13:11:37 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Primary script unknown error is logged while accessing non-existent file.

Applicable to:

  • Plesk for Linux

Symptoms

  • CodeIgniter website does not work correctly.

  • Requesting non existent php file like http://example.com/does-not-exist.php results in an entry in /var/www/vhosts/example.com/logs/error_log:

        [Wed Aug 24 11:04:45.893616 2016] [proxy_fcgi:error] [pid 10954] [client 203.0.113.2:56356] AH01071: Got error 'Primary script unknown\

    Instead of 404 error.

Cause

This is a default behavior of apache + nginx.

Resolution

Add the rewrite rule into /var/www/vhosts/example.com/httpdocs/.htaccess in order to check the file before sending it to php handler. The following rewrite rule checks if the requested file exists and returns index.php page if no.

    <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

More information regarding rewrite rules could be found at apache official web site .

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