MediaTemple上的ExpressionEngine-删除index.php会导致;未指定输入文件";

MediaTemple上的ExpressionEngine-删除index.php会导致;未指定输入文件";,expressionengine,mediatemple,Expressionengine,Mediatemple,我有一个带有标准ExpressionEngine htaccess代码的MT站点,可以删除index.php和主页,如果我将index.php放在URL中,所有其他页面都可以工作。如果没有它,我会得到“没有指定输出文件”。它在我的本地和非MT服务器上工作,所以我知道这是一个环境问题。htaccess中的哪些内容需要更改才能在MT上工作 <IfModule mod_rewrite.c> # Enable Rewrite Engine # -----------------------

我有一个带有标准ExpressionEngine htaccess代码的MT站点,可以删除index.php和主页,如果我将index.php放在URL中,所有其他页面都可以工作。如果没有它,我会得到“没有指定输出文件”。它在我的本地和非MT服务器上工作,所以我知道这是一个环境问题。htaccess中的哪些内容需要更改才能在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>

#启用重写引擎
# ------------------------------
重新启动发动机
重写基/
#使用Dynamic robots.txt文件
# ------------------------------
重写规则robots\.txt/robots.php[L]
#重定向index.php请求
# ------------------------------
RewriteCond%{THE_REQUEST}^GET.*index\.php[NC]
重写cond%{THE_REQUEST}/管理员/*
重写规则(.*)索引\.php/*(.*)/$1$2[R=301,L]
#标准表达式引擎重写
# ------------------------------
重写秒$1!\。(css | js | gif | jpe?g | png)[NC]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/index.php?/$1[L]

感谢@danielcgold通过twitter提供的答案:


尝试使用这一行
RewriteRule^(.*)$/index.php?/$1[L]
,并记下?在index.php之后

我昨晚发布了一个要点,其中包含了我在(mt)上所有ExpressionEngine站点的标准重写规则


使用EE 2.7.0和Mediatemple的网格服务(以前称为“GS”),我很幸运地使用了标准。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>

重新启动发动机
#从ExpressionEngine URL中删除index.php
重写秒$1!\。(gif | jpe?g | png)$[NC]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/index.php/$1[L]
但随后进入AccountCenter>[mydomain.com]>PHP设置,将PHP版本从5.5.1 CGI(最新版本)更改为5.3.7 CGI(稳定版)我发布在ExpressionEngine Stack Exchange网站上,但简而言之,我们不得不使用的共享托管环境被迫使用FastCGI,我们无法修改任何CGI或PHP配置

在尝试自己创建
$\u服务器['PATH\u INFO']
变量时,对我有效的是这3步“自定义”方法:

  • 首先,在
    ExpressionEngine>CP Home>Admin>System Administration>Output And debug
    中,我将Force URL查询字符串设置为No
  • 接下来,如前面的回答所述,我将
    .htaccess
    指令从
    RewriteRule^(.*$/index.php/$1[L,QSA]
    更改为
    RewriteRule^(.*$/index.php?/$1[L,QSA]
    (index.php之后的额外字符)
  • 最后,我将这段自定义PHP代码添加到站点root的
    index.PHP
    文件的顶部,以“强制”
    $\u服务器['PATH\u INFO']
    变量精确存在:

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

    如果Chad能用工作脚本编辑原始帖子就好了。有点不清楚正确的迭代是什么,我肯定想试试这个.htaccess文件。@JustinKimbrell用Chad的更正替换最后一行。我使用的是MediaTemple DV4和我的标准。升级后htaccess将无法工作。这个答案解决了我的问题。我上周才发现,Plesk默认情况下会将运行PHP的服务器设置为FastCGI,因此上次重写规则中需要
    。直到前几天我才完全意识到这一点。切换回Apache下运行PHP允许删除
    。有关301问题的更多上下文,请参见本线程:如果您使用这种方法添加?在index.php的末尾,您使用301重定向将旧页面重定向到新页面,您可能会发现重定向到一个404页面,URL/?/旧页面。在这种情况下,不要使用301重定向,而是使用重写规则。请看这里:
    <?php
    
        $path = $_SERVER['REQUEST_URI'];
        $pos = strpos($path, '?');
        if ($pos !== false)
            $path = substr($path, 0, $pos);
        $_SERVER['PATH_INFO'] = $path;
    
        /**
         * ExpressionEngine - by EllisLab
           ...
           ...