我正试着做一个简单的点击并转到另一个页面,但codeigniter给我的提示是“没有找到,请求的URL在此服务器上找不到。”
Apache/2.4.48 (Win64) OpenSSL/1.1.1kPHP/7.4.20本地主机端口80的服务器
我的控制器:
<?php
class Onekey extends MY_Controller {
public function __construct(){
parent::__construct();
$this->load->model('Onekey_model');
}
public function index(){
$this->render('onekey', 'Onekey_model');
}
public function teste(){
$this->render('teste', 'Onekey_model');
}HTML
````<form method="post" action="teste" class="login_form" accept-charset="utf-8">
<button>Entrar</button></form>````Htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>配置文件
$config['index_page'] = 'onekey';
$config['base_url'] = 'http://localhost/';我曾尝试在表单action="onekey/teste"中使用,但仍然一无所获
编辑:
如果我做action="index.php/onekey/teste"它工作,所以我的问题是index.php,我如何解决它?
发布于 2021-06-23 02:21:05
也许可以将system和application的RewriteCond结合起来?另外,我在我的CI htaccess中添加了另一行
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [QSA, L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>https://stackoverflow.com/questions/68084118
复制相似问题