How to fix "404 Page not found" error in codeigniter?

时间:2019-01-07 14:03:07

标签: php .htaccess codeigniter-3 codeigniter-htaccess

I had a project in codeigniter setup on localhost. And today I put the same project on server. On localhost it was working fine but after moving it to online server, it is not working and giving only "404 Page not found" error.

To resolve it, I changed the $config['base_url'] and the .htaccess file I'm using is below:

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
Options -Indexes
## Mod_rewrite in use.

RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

Please let me know how can I resolve this issue?

1 个答案:

答案 0 :(得分:0)

我可能不确定,但请检查您的控制器名称和型号名称...以后用大写字母开头...我的意思是...在服务器上它会起作用...如果您的控制器名称... ... { 1}} ..将其更改为xyz_controller.php ..与模型相同..做到这一点..与类名相同...以后需要用大写字母注目...