代码点火器路径错误

发布于 2024-12-20 21:44:53 字数 497 浏览 4 评论 0原文

我已经通过 .htaccess 关闭了 codeigniter 中的 index.php,并且将 config.php 中的索引文件留空 这是 .htaccess 代码,

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

我有一个指向我的控制器功能的链接,作为“cuser/authenticate”,因此 url 看起来像

mydoamin.com/cuser/authenticate

,但它显示一个错误,告诉路径未找到 当我编辑上面的 url 并

mydomain.com/index.php/cuser/authenticate

显示输出

时,我该如何解决这个问题?

i have turned off index.php in my codeigniter by .htaccess and also i left blank the index file in config.php
this is .htaccess code

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

i have a link to my controller function as 'cuser/authenticate' so the url looks like

mydoamin.com/cuser/authenticate

but it shows an error telling path not found
when i edit the above url to

mydomain.com/index.php/cuser/authenticate

it displays output

how can i tackle this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不必你懂 2024-12-27 21:44:53
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

这些设置对我有用

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

These settings worked for me

一页 2024-12-27 21:44:53

您可以将 application/config/config.php 中的 $uri_protocol"AUTO" 更改为 "REQUEST_URI"

You may change $uri_protocol in the application/config/config.php from "AUTO" to "REQUEST_URI".

银河中√捞星星 2024-12-27 21:44:53

你试过这个吗?

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

have you tried this ?

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
计㈡愣 2024-12-27 21:44:53

这是从我的 codeigniter 安装的最新版本中直接复制/粘贴的内容。

在 config.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> 

Heres straight copy/paste from my codeigniter installs, latest version..

set the following in your config.php

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

create a .htaccess and fill it with this:

<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> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文