Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.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/8/.htaccess/5.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
当访问没有index.php的页面时,CodeIgniter给出404_Php_.htaccess_Codeigniter - Fatal编程技术网

当访问没有index.php的页面时,CodeIgniter给出404

当访问没有index.php的页面时,CodeIgniter给出404,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,通过访问时,我收到404个错误: 虽然这些都很好: .htaccess-从以下位置获取: 更新: 在错误日志中获取此信息: [Wed Dec 28 17:54:30 2011][notice]无法在401 ErrorDocument指令中使用完整URL--忽略 没关系,已经修好了。 应该是: 重写规则^(.*)$z/index.php/$1[L] 而不是 重写规则^(.*)$index.php/$1[L] 因为代码在z文件夹中。感谢您的访问。:) 是的,您可以很容易地从.htaccess的

通过访问时,我收到404个错误:

虽然这些都很好:

.htaccess-从以下位置获取:

更新: 在错误日志中获取此信息:
[Wed Dec 28 17:54:30 2011][notice]无法在401 ErrorDocument指令中使用完整URL--忽略

没关系,已经修好了。

应该是:

重写规则^(.*)$z/index.php/$1[L]

而不是

重写规则^(.*)$index.php/$1[L]


因为代码在z文件夹中。感谢您的访问。:)

是的,您可以很容易地从.htaccess的url中删除index.php,请检查此项以了解更多详细信息。

首先进入配置文件。。。。 然后设置$config['index_page']=''; 然后创建一个扩展名为.htacess的文件,并在其中写入下面的代码,然后保存在根目录中

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

虽然您已经“解决”了问题中的问题,但您的实现实际上是不正确的

要正确实现这一点,您应该更改RewriteBase指令,而不是将规则专门指向文件夹

就你而言

RewriteBase /z/

另一方面,你不应该修改你的问题,说你已经解决了它,你应该发布一个同样效果的答案。这可以防止问题出现在未答复的源等中。

链接不可访问:“对不起,您没有访问此资源的权限。”该链接将在我这边打开。检查你的防火墙,如果你有???
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteBase /z/