我已经关闭了 index.php 在我的代码点火器中通过 .htaccess 并且我在 config 中将索引文件留空.php这是 .htaccess 代码
RewriteEngine on
RewriteCond $1 !^(index'.php|images|captcha|css|js|robots'.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我有一个指向我的控制器功能的链接,作为"CUSER/身份验证",因此 URL 看起来像
mydoamin.com/cuser/authenticate
但它显示错误告诉找不到路径当我将上面的 URL 编辑为
mydomain.com/index.php/cuser/authenticate
它显示输出
我该如何解决这个问题?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
这些设置对我有用
您可以将
application/config/config.php
中的$uri_protocol
从"AUTO"
更改为"REQUEST_URI"
。
你试过这个吗?
RewriteEngine on
RewriteCond $1 !^(index'.php|resources|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
这是从我的编码点火器安装中直接复制/粘贴的最新版本。
在配置中设置以下内容.php
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
创建一个 .htaccess 并用以下内容填充它:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#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>