ExpressionEngine on MediaTemple - removing index.php results in "missing input file"

I have an MT site with the standard ExpressionEngine htaccess code to remove index.php, and the home page works, and all the other pages work if I put index.php in the URL. Without this, I get an "unspecified output file". It works on my local and non-MT server, so I know its environment. What needs to be changed in htaccess to make it work with MT?

<IfModule mod_rewrite.c> # Enable Rewrite Engine # ------------------------------ RewriteEngine On RewriteBase / # Use Dynamic robots.txt file # ------------------------------ RewriteRule robots\.txt /robots.php [L] # Redirect index.php Requests # ------------------------------ RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteCond %{THE_REQUEST} !/admin/.* RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L] # Standard ExpressionEngine Rewrite # ------------------------------ RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L] </IfModule> 
+4
source share
4 answers

I posted a Gist last night with my standard rewrite rules for all of my ExpressionEngine (mt) sites.

 ## BEGIN Expression Engine Rewrite RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteRule ^(.*)$ /index.php?/$1 [L] ## END Expression Engine Rewrite 
+5
source

Thanks @danielcgold for the answer via twitter:

Try using this line RewriteRule ^(.*)$ /index.php?/$1 [L] and notice? after index.php

+7
source

Using the EE 2.7.0 service and the Mediatemple Grid (formerly "GS"), I was fortunate enough to use the standard .htaccess:

 <IfModule mod_rewrite.c> RewriteEngine On # Removes index.php from ExpressionEngine URLs RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule> 

but then go to AccountCenter> [mydomain.com]> PHP Settings and change the PHP version from 5.5.1 CGI (latest) to 5.3.7 CGI (stable) .

0
source

I posted this solution on the ExpressionEngine Stack Exchange website, but in a nutshell we used a shared hosting environment that was used to use FastCGI, t modify any CGI or PHP configuration.

In an attempt to create the $_SERVER['PATH_INFO'] variable, I myself applied this three-step "user" approach:

  • First, in ExpressionEngine > CP Home > Admin > System Administration > Output And Debugging , I set the Force URL strings to None .
  • Further, as mentioned in previous answers, I changed the .htaccess directive from RewriteRule ^(.*)$ /index.php/$1 [L,QSA] to RewriteRule ^(.*)$ /index.php?/$1 [L,QSA] (added after index.php).
  • Finally, I added this piece of custom PHP code to the top of the root index.php file of the site to "force" the $_SERVER['PATH_INFO'] variable into its exact existence:

     <?php $path = $_SERVER['REQUEST_URI']; $pos = strpos($path, '?'); if ($pos !== false) $path = substr($path, 0, $pos); $_SERVER['PATH_INFO'] = $path; /** * ExpressionEngine - by EllisLab ... ... 

Hope this helps someone! I really pulled my hair out trying to find some more elegant solutions!

0
source

Source: https://habr.com/ru/post/1444708/


All Articles