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.

 

via。https://support.plesk.com/hc/en-us/articles/214029589-Primary-script-unknown-error-is-logged-while-accessing-non-existent-file-

最后修改:2017 年 07 月 27 日 06 : 26 AM