GoDaddy服务器上的CodeIgniter和URI问题

Rya*_*yan 0 php codeigniter

我似乎无法在GoDaddy上正确设置CodeIgniter.我尝试在'wecome'控制器中创建一个新函数.但我无法在任何地方访问它.

http://domain.com/test   (No response) <- why doesn't this work
http://domain.com/index.php/welcome/test   (No response) <- why doesn't this work
Run Code Online (Sandbox Code Playgroud)

只是为了让您了解默认欢迎页面如何解决:

http://domain.com/   (resolves to welcome page aka 'index' function)
http://domain.com/index.php/   (resolves to welcome page aka 'index' function)
http://domain.com/index.php/welcome   (No response) <- why doesn't this work?
http://domain.com/index.php/welcome/index (No response) <-why doesn't this work?
Run Code Online (Sandbox Code Playgroud)

如何才能正确设置?

kam*_*mal 5

步骤1.在根目录下的.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]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]
Run Code Online (Sandbox Code Playgroud)

步骤2.打开/system/application/config/config.php文件并确保设置了以下两个选项.

$config['index_page'] = “”;
$config['uri_protocol'] = “AUTO“;
Run Code Online (Sandbox Code Playgroud)

希望这有帮助.