ошибка пути codeigniter

я отключил index.php в своем codeigniter с помощью .htaccess, а также оставил пустым индексный файл в 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

он отображает вывод

как я могу решить эту проблему?


person Bilal    schedule 13.12.2011    source источник
comment
Возможный дубликат stackoverflow.com/questions/7716273/. Посмотрите там.   -  person swatkins    schedule 13.12.2011


Ответы (4)


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

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

Эти настройки мне подошли

person Junaid    schedule 29.02.2012

Вы можете изменить $uri_protocol в application/config/config.php с "AUTO" на "REQUEST_URI".

person Ridwan 张立万 Budiman    schedule 13.12.2011

ты пробовал это?

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

Вот прямая копия/вставка из моих установок 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> 
person gorelative    schedule 14.12.2011