Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.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“;从URL_Php_Codeigniter_Url_Url Rewriting - Fatal编程技术网

代码点火器:故障排除“;index.php“;从URL

代码点火器:故障排除“;index.php“;从URL,php,codeigniter,url,url-rewriting,Php,Codeigniter,Url,Url Rewriting,几天来,我一直在尝试修复此问题,并尝试了以下教程: 关于堆栈溢出 来自CI论坛 还有很多其他的 没有一个奏效 我的问题是: 每当我在WAMP localhost/ci/index.php/HomeController中单击站点链接时 它很好用 如果我从url中省略“index.php” (本地主机/ci/HomeController), 但是,它显示的文件夹列表与localhost上的相同 这是我在根目录下的htaccess文件: <IfModule mod_rewrite.c>

几天来,我一直在尝试修复此问题,并尝试了以下教程:

  • 关于堆栈溢出

  • 来自CI论坛

还有很多其他的

没有一个奏效

我的问题是:

每当我在WAMP localhost/ci/index.php/HomeController中单击站点链接时 它很好用

如果我从url中省略“index.php” (本地主机/ci/HomeController), 但是,它显示的文件夹列表与localhost上的相同

这是我在根目录下的htaccess文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 
这仍然将我重定向到WAMP主页

我还取消了对此的注释(在httpd.conf文件中)

其他信息:

在my routes.php文件中:

$route['default_controller'] = "HomeController";
我的缩写文件结构: (位于C:\wamp\www)

  • /词
    • /应用
      • /缓存
      • /配置
      • /控制器
      • /核心
      • /错误
      • /助手
      • /钩子
      • /语言
      • /图书馆
      • /日志
      • /模型
      • /第三方
      • /观点
      • .htaccess
      • index.html
    • /资产
    • /系统
    • .htaccess
    • index.php
感谢您的帮助。抱歉,如果已经有关于此主题的答案。没有人为我的项目工作过

编辑

如果我尝试此htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
我得到:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
请尝试以下访问方式:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
这是我在项目中用于删除index.php的默认htaccess

RewriteBase
/ci/
)和
RewriteRule
/ci/index.php
)应该引用项目的基本目录。也就是说,您的项目是否位于

此外,如果您在WAMP上托管项目,则需要在配置中启用htaccess。为此,单击WAMP图标并选择Apache->Apache模块->重写模块。然后重新启动所有服务


祝你好运

在WAMP环境中,从Codeigniter的url中删除index.php只需要三个步骤

1) 与应用程序持有者并行创建.htacess文件,只需复制以下代码即可:

RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
2) 在应用程序文件夹的config.php中将$config['index_page']更改为空,如下所示:

$config['index_page'] = '';
3) 启用apache的“重写\u模块”

重新启动apache并完成它


详细信息:

很抱歉,这对我不起作用。我得到了一个“内部服务器错误”。奇怪的是,我在我的子文件夹上使用了这个htaccess,它也被命名为ci,工作正常。很抱歉,我帮不上什么忙了。如果我得到新的smh,我会编辑这个。。将此htaccess放入ci文件夹,使其位于此处:
ci/.htaccess
它已在此处。。。我可以运行任何测试来调试它吗?
$config['index_page'] = '';