Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.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

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
Php 需要更改htaccess重写代码吗_Php_Apache_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Php 需要更改htaccess重写代码吗

Php 需要更改htaccess重写代码吗,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,我刚刚遇到一个Codeigniter网站的问题,在托管公司将文件迁移到新服务器后,我无法再离开主页。我在谷歌上搜索了一个有类似问题的论坛,答案是我的htacess文件。以前是这样的, Options FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^

我刚刚遇到一个Codeigniter网站的问题,在托管公司将文件迁移到新服务器后,我无法再离开主页。我在谷歌上搜索了一个有类似问题的论坛,答案是我的htacess文件。以前是这样的,

 Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule> 
选项后面的符号链接
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
给出的解决方案是在“index.php”之后添加一个“?”字符。我做到了,然后一切正常


我努力理解htaccess代码和语法,阅读了很多文档,但它们也可能是用中文编写的。那么,有人能解释为什么需要额外的“?”吗?它做了什么?如果你也能解释代码的其余部分,我将永远感激你

新主机的php处理程序或Web服务器未设置为处理路径信息,或脚本(index.php)后的内容,这些内容是实际路径的一部分,例如

/index.php/this/is/part/of/the/path_info
执行
index.php
脚本,之后的所有内容都可以通过“PATH\u INFO”获取。如果服务器不处理这个问题,代码点火器可以选择处理作为查询字符串传入的路径。哪些是
后面的参数?


这些都与htaccess或mod_重写无关。这就是url和处理程序的工作方式。

你知道
index.php/foo
index.php吗?foo
url意味着什么吗?啊,非常感谢。关于阿帕奇的古怪,我得出了所有错误的结论。现在清楚了。但是,我仍然不理解代码的其余部分!