Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 不推荐使用路径\u INFO.htaccess规则已损坏_Apache_.htaccess_Redirect_Expressionengine_Pathinfo - Fatal编程技术网

Apache 不推荐使用路径\u INFO.htaccess规则已损坏

Apache 不推荐使用路径\u INFO.htaccess规则已损坏,apache,.htaccess,redirect,expressionengine,pathinfo,Apache,.htaccess,Redirect,Expressionengine,Pathinfo,最近,我的主机提供商一直在将他们的apache系统更新到2.4.4。这样做会导致我的表达式引擎站点崩溃,因为我现在需要强制查询字符串以使站点运行 据我所知,您只需将.htaccess规则中的一行更新为 RewriteRule ^(.*)$ /index.php?/$1 [L] 不幸的是,解决这个问题的方法没有这么简单 我的网站使用一个定制的表达式引擎插件来检测他们在世界哪个地区使用IP到国家模块。基本上,如果你来自美国,你会看到包含美国内容的网站&如果你来自其他任何地方,它会在URI的第一部分

最近,我的主机提供商一直在将他们的apache系统更新到2.4.4。这样做会导致我的表达式引擎站点崩溃,因为我现在需要强制查询字符串以使站点运行

据我所知,您只需将.htaccess规则中的一行更新为

RewriteRule ^(.*)$ /index.php?/$1 [L]
不幸的是,解决这个问题的方法没有这么简单

我的网站使用一个定制的表达式引擎插件来检测他们在世界哪个地区使用IP到国家模块。基本上,如果你来自美国,你会看到包含美国内容的网站&如果你来自其他任何地方,它会在URI的第一部分附加“international”,这将根据URI的第一部分显示国际内容

比如说

http://www.example.com/segment_1/segment_2/segment_2 = US SITE

http://www.example.com/international/segment_1/segment_2/segment_2 = INTERNATIONAL SITE 
当我尝试将该查询字符串添加到rewriteRule for index.php时,它破坏了国际网站,我不知道为什么

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule /international/(.*)$ /index.php/$1 [L]
将“?”添加到
RewriteRule^(.*)$/index.php?/$1[L]
修复了美国网站,但破坏了国际网站,说它找不到国际页面

将“?”添加到
RewriteRule/international/(.*)$/index.php?/$1[L]
可以修复国际站点,但是美国站点将无法工作,因为它需要查询字符串

而将其添加到两者中也不会起作用

显然,我在.htaccess中遗漏了一些东西来克服这个问题,但我似乎无法生成正确的语法


有什么想法吗?

我想在这里胡乱猜测一下,这样可能完全没用

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule /international/(.*)$ /index.php/$1 [L]
这个问题看起来像是你重写了添加到index.php?中的URL,然后再次添加到international中-因此,当你将“?”添加到两者时,它会终止重写

因此,在第一次重写中,您需要排除国际性,而在第二次重写中,您需要确保它只影响国际性

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(international)
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} (international)
RewriteRule /international/(.*)$ /index.php?/$1 [L]
对于第二部分,您可能需要重复3个初始条件

更新

这让它最终成功了(感谢你为我指明了正确的方向-卢克)


这篇布告成功了,它为我指明了正确的方向,非常感谢。我只需要在if international之后添加
RewriteRule^(.*)$/index.php/$1[L]
,因为index.php仍然需要可用+我确实需要为第二部分重复3个初始条件。谢谢@peter lewis
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(international)
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (international)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule /international/(.*)$ /index.php?/$1 [L]