Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

php-fpm subdomain rewrite problem

Discussion in 'EasyApache' started by vacancy, Feb 22, 2017.

  1. vacancy

    vacancy Well-Known Member

    Sep 20, 2012
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello there

    The rewrite function does not work in some subdomains I have enabled php-fpm.

    I see a not found error when I enter the rewritten pages.

    Html pages and home page are also fine.

    Apache log

    [Thu Feb 23 01:23:46.537039 2017] [proxy_fcgi:error] [pid 11216:tid 107208547481344] [client 178.240.*.*:60759] AH01071: Got error 'Primary script unknown\n', referer:
    [Thu Feb 23 01:23:46.538710 2017] [proxy_fcgi:error] [pid 11216:tid 107208652609280] [client 84.51.*.*:60760] AH01071: Got error 'Primary script unknown\n', referer:
    [Thu Feb 23 01:23:46.704341 2017] [proxy_fcgi:error] [pid 11216:tid 107208661464832] [client 84.51.*.*:60769] AH01071: Got error 'Primary script unknown\n', referer:
    [Thu Feb 23 01:23:46.714214 2017] [proxy_fcgi:error] [pid 11216:tid 107208511764224] [client 151.135.*.*:60770] AH01071: Got error 'Primary script unknown\n', referer:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    # remove ETag from images
    Header unset ETag
    FileETag none
    <ifModule mod_expires.c>
      ExpiresActive On
      ExpiresDefault "access plus 1 seconds"
      ExpiresByType text/html "access plus 1 seconds"
      ExpiresByType image/gif "access plus 2592000 seconds"
      ExpiresByType image/jpeg "access plus 2592000 seconds"
      ExpiresByType image/png "access plus 2592000 seconds"
      ExpiresByType text/css "access plus 604800 seconds"
      ExpiresByType text/javascript "access plus 216000 seconds"
      ExpiresByType application/x-javascript "access plus 216000 seconds"
      ExpiresByType application/javascript "access plus 216000 seconds"
    <ifModule mod_headers.c>
      <filesMatch "\\.(ico|mp3|jpg|jpeg|png|gif|swf|ttf)$">
        Header set Cache-Control "max-age=2592000, public"
      <filesMatch "\\.(css)$">
        Header set Cache-Control "max-age=604800, public"
      <filesMatch "\\.(js)$">
        Header set Cache-Control "max-age=216000, private"
      <filesMatch "\\.(xml|txt)$">
        Header set Cache-Control "max-age=216000, public, must-revalidate"
      <filesMatch "\\.(html|htm|php)$">
        Header set Cache-Control "max-age=1, private, must-revalidate"
    <FilesMatch ".(eot|ttf|otf|woff)">
            Header set Access-Control-Allow-Origin "*"
    # php -- BEGIN cPanel-generated handler, do not edit
    # NOTE this account's php is controlled via FPM and the vhost, this is a place holder.
    # Do not edit. This next line is to support the cPanel php wrapper (php_cli).
    # AddType application/x-httpd-ea-php55 .php .phtml
    # php -- END cPanel-generated handler, do not edit
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello @vacancy,

    The "Primary script unknown"error message occurs with PHP-FPM when a rewrite rule in the .htaccess file forces the use of a specific file that does not exist.

    You can verify an index.php file exists in the document root where this happened to confirm that's what lead to the error message.

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice