Codeigniter 3 代码点火器3路由错误

Codeigniter 3 代码点火器3路由错误,codeigniter-3,Codeigniter 3,我在codeigniter 3上遇到路由错误 找不到 在此服务器上找不到请求的URL/index.php。Apache/2.4.7(Ubuntu)服务器 我所做的。 我的.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ in

我在codeigniter 3上遇到路由错误

找不到 在此服务器上找不到请求的URL/index.php。Apache/2.4.7(Ubuntu)服务器

我所做的。 我的.htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
我的路线:
$route['test/(:any)]='test/$1'

并尝试通过url访问此页面:

http://localhost/codeigniter/test/index.php
http://localhost/codeigniter/test/

试试这个
.htaccess

RewriteEngine on

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

如果您正在访问控制器只需键入(假定
codeigniter
作为项目文件夹名称)


这个
$route['test/(:any)]='test/$1'的原因是什么

这意味着将有一个参数传递给此。它可以是数字或字母。Ex
http://localhost/codeigniter/test/aaa
http://localhost/codeigniter/test/25



试试这个
.htaccess

RewriteEngine on

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

如果您正在访问控制器只需键入(假定
codeigniter
作为项目文件夹名称)


这个
$route['test/(:any)]='test/$1'的原因是什么

这意味着将有一个参数传递给此。它可以是数字或字母。Ex
http://localhost/codeigniter/test/aaa
http://localhost/codeigniter/test/25



您的问题是,当您尝试使用此路由时,您传递的uri(2),uri(2)是用于控制器的方法的
codeigniter/test/1
您应该首先指定您的方法,因此它是这样的
$route['test/(any)]='test/index/$i' >代码>代码点火器< /代码>被认为是你的URI(0)。

< P>你的问题是你的URI(2),URI(2)是用于控制器的方法,当你尝试使用这个路由<代码>代码点火器/测试/ 1 < /代码>时,你应该先指定你的方法,这样它就行了。代码> $路由[测试/ /(任何)] =“测试/索引/$i”;<代码> BTW <代码>代码点火器< /代码>被视为您的URI(0)。< /P>
http://localhost/codeigniter/test/