codeigniter is not working after uploading in the server

Multi tool use
codeigniter is not working after uploading in the server
My site http://www.bishal.prtia.com/prT_base/
throw an 404
error while loading in the server.
http://www.bishal.prtia.com/prT_base/
404
It works perfectly in the localhost
. I tried changing everything that mentioned in this forum like changing .htaccess
to web.config and changing base url routing config etc but it still throws an error.
localhost
.htaccess
should i copy paste the whole code here?? Please specify anything u want to see
– Bishal Chhetri
Dec 27 '17 at 7:45
have you find the solution?
– Chaitanya Desai
Dec 28 '17 at 5:28
3 Answers
3
You need to do few steps.
base_url
config.php
RewriteBase
.htaccess
error_reporting(E_ALL)
index.php
Can u please elaborate ?? my config.php have $config['base_url'] = 'bishal.prtia.com/prT_base';; Rewritebase is RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.php|assets) RewriteRule ^(.*)$ index.php/$1 [L] . Please elaborate 3rd and 4rth
– Bishal Chhetri
Dec 27 '17 at 7:49
Well, after uploading, you need to change base_url like locally it will be something
localhost/codeigniter
and for online it will be http://www.bishal.prtia.com/prT_base/
. Then if its in sub directory of main hosting then you need to set rewritebase
in htaccess– Naveed Ramzan
Dec 27 '17 at 7:51
localhost/codeigniter
http://www.bishal.prtia.com/prT_base/
rewritebase
Check the following things once again:
RewriteEngine on
RewriteCond $1 !^(index.php|assets|images|js|css|upload|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
RewriteEngine on
RewriteCond $1 !^(index.php|assets|images|js|css|upload|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
Then check following thigs:
Config.php
Routes.php
Make sure php file name of controller start with capital letter like Welcome and also inside that file as well when inherit from CI_Controller
Function inside Welcome.php:
public function index()
{
$this->load->view('your view file');
}
Thanks
I tried like you said but now my main page isnt loading. What did i do wrong??
– Bishal Chhetri
Dec 27 '17 at 7:57
@BishalChhetri Does your prT_base is the controller name or the folder which contains all your code?
– Hardik Shah
Dec 27 '17 at 7:59
prT_base in the main folder name which contains everything
– Bishal Chhetri
Dec 27 '17 at 8:06
Then check following thigs: 1. $config['base_url'] = 'bishal.prtia.com/prT_base/';;
– Hardik Shah
Dec 27 '17 at 8:07
Edited my answer please check again. It should work other wise check error log
– Hardik Shah
Dec 27 '17 at 8:13
I also faced this error. I changed my .htaccess file [WORKED FOR ME] :-
.htaccess for Live Server :-
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|robots.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
.htaccess for Localhost :-
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Basically you need to show us your code and the other config to determine the problem
– Riyenz
Dec 27 '17 at 7:44