mod_rewrite在Apache2.4上工作不正确

mod_rewrite在Apache2.4上工作不正确,apache,.htaccess,mod-rewrite,apache2,apache2.4,Apache,.htaccess,Mod Rewrite,Apache2,Apache2.4,我以前用过其他主机,一切正常,但现在我把它换成了新的。新主机上安装了apache 2.4 我有以下规则: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^/?(.*) http://%1/$1 [L,R=permanent] Rewr

我以前用过其他主机,一切正常,但现在我把它换成了新的。新主机上安装了apache 2.4

我有以下规则:

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /
        RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
        RewriteRule ^/?(.*) http://%1/$1 [L,R=permanent]

        RewriteRule manage/ajax/(.*?)$ manage/ajax/index.php [QSA,L]
        RewriteRule manage/json/(.*?)$ manage/json/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule ckfinder/(.*?)$ ckfinder/index.html [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule manage/(.*?)/$ manage/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule ajax/(.+?) ajax/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule api/(.*?) /api/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule (.*) index.php
</IfModule>

重新启动发动机
重写基/
重写条件%{HTTP_HOST}^www\(.*)[NC]
重写规则^/?(*)http://%1/$1[L,R=永久]
重写规则manage/ajax/(**?$manage/ajax/index.php[QSA,L]
重写规则manage/json/(.*)$manage/json/index.php[QSA,L]
重写条件%{REQUEST\u URI}!\。(.+)$
重写规则ckfinder/(.*)$ckfinder/index.html[QSA,L]
重写条件%{REQUEST\u URI}!\。(.+)$
重写规则manage/(**?/$manage/index.php[QSA,L]
重写条件%{REQUEST\u URI}!\。(.+)$
重写规则ajax/(.+?)ajax/index.php[QSA,L]
重写条件%{REQUEST\u URI}!\。(.+)$
重写规则api/(**?)/api/index.php[QSA,L]
重写条件%{REQUEST\u URI}!\。(.+)$
重写规则(.*)index.php
例如,当我尝试访问/manage/时,它会显示索引页,但如果我将向路径添加一些附加数据,它会显示我所需的内容。例如:/manage/some_data-可以正常工作。但是我只想通过/manage/来访问正确的目录更改此规则:

RewriteCond %{REQUEST_URI} !\.(.+)$
RwriteRule manage/(.*?)/$ manage/index.php [QSA,L]


同样的结果,没有任何更改。绝对确定键入的内容正确吗?正则表达式应该有效。请看这里:我认为这个问题不在正则表达式中,因为我的规则在旧服务器上运行良好。我认为在逻辑上有问题,可能是在新的apache中用mod_rewrite改变了什么?您的旧正则表达式看起来不正确,它只会匹配您看到的内容,即
管理/某些数据
管理/
(.*?
部分会阻止
管理/
成为匹配项。好的,也许我的正则表达式也错了,但是你的正则表达式没有解决我的问题。此外,正如您可以看到的那样,还有api、ajax和其他。我对所有这些查询都有同样的问题。我认为主逻辑中存在一些问题。只需在.htaccess的顶部使用
DirectoryIndex.php
,谢谢,这就解决了我的问题。不客气,很高兴它有帮助。
RewriteCond %{REQUEST_URI} !\.(.+)$
RwriteRule manage(/.*)?$ manage/index.php [QSA,L]