1

I currently working in a web app using Codeigniter framework. It works well locally with Wampserver32 but when passing it to a live apache server it only loads the home page and when I try to route to another page it goes: Error - 404

I've already tried changing:

1- $config['index_page'] = 'index.php'; to$config['index_page'] = 'index.php'?;

2- $config['uri_protocol'] = 'REQUEST_URI'; to $config['uri_protocol'] = 'PATH_INFO';

I've actually blocked for 1 day.


confing.php file

...
$config['base_url'] = 'http://s661658794.onlinehome.fr/admin';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'PATH_INFO';
...

routes.php file

$route['default_controller'] = 'welcome';
$route['Admin'] = 'admin/Login';
$route['Login'] = 'admin/Login/dashboard';
$route['Home'] = 'admin/Home';
$route['Userinfo'] = 'admin/Usercontroller';
$route['History'] = 'admin/Historycontroller';
$route['Changepassword'] = 'admin/Changepassword';
$route['Notification'] = 'admin/Notification';
$route['Logout'] = 'admin/Login/logout';
$route['Forgotpassword'] = 'admin/Login/Forgotpassword';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

.htaccess file

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

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 year"
</IfModule>
## EXPIRES CACHING ##


<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<ifModule mod_headers.c>
    Header set Connection keep-alive
</ifModule>


RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]

folders

-/
---admin
------application
------assets
------system
------user_guide
Cœur
  • 37,241
  • 25
  • 195
  • 267
fegugi
  • 11
  • 4
  • any live links there for us ?? – Abdulla Nilam Dec 22 '16 at 17:39
  • Are you sure you uploaded .htaccess? Have you checked all of your file/folder permissions and ownership? – elixenide Dec 22 '16 at 17:40
  • Relevant: http://stackoverflow.com/questions/29939581/codeigniter-home-page-working-fine-but-showing-404-for-other-pages?rq=1 Have you eliminated that problem? – elixenide Dec 22 '16 at 17:41
  • `http://s661658794.onlinehome.fr/admin` access ur URL and check the ERROR message first of all – Abdulla Nilam Dec 22 '16 at 17:41
  • Hey guys I just shut the server down so the link http://s661658794.onlinehome.fr/admin is not working for the moment. I'm going to turn it up so you can check the link – fegugi Dec 22 '16 at 17:53
  • Now the server is working again. Sorry for that. – fegugi Dec 22 '16 at 17:59
  • You can try just inserting a random username and password. Normally I would relink you to the same page with an connection error message. – fegugi Dec 22 '16 at 18:03

2 Answers2

0

If your index.php file located inside of admin in public_html folder then you need to replace it with following code.

Your code

Rewrite

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

Might be work for you

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ admin/index.php?/$1 [L,QSA]
Ankit vadariya
  • 1,253
  • 13
  • 14
0

Looks like you need to adjust your application/config/database.php to match your apache servers database settings.

wclark
  • 436
  • 4
  • 14
  • Hey wclark. I already adjusted the database.php file. But it still not working. Do you know if there is a way I could ckeck if my app connects correctly to the database? – fegugi Dec 22 '16 at 18:09
  • You could do a lookup in your database to confirm it is working. Usually this is done by the password hash lookup when a user submits your login form. – wclark Dec 22 '16 at 18:17
  • Do I have to check the password hash in the data base? Sorry, I do not understand. – fegugi Dec 22 '16 at 18:23
  • Maybe this will help: http://stackoverflow.com/questions/26222549/php-mysql-check-if-username-and-password-are-in-the-database – wclark Dec 22 '16 at 18:42