Internal server error in the encoder on the host

I have deployed a site that uses CodeIgniter in the main public_html folder (http://www.myexample.com)

. This project works fine on localhost. To remove index.php from url it has the following .htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

      

However, when I try to navigate to the site, I get an internal server error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@its.org.pk to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

      

I have applied different .htaccess files, but I get the same error.

+3


source to share


3 answers


What I usually do when migrating to a live server is as follows First .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>

      

then the database username and password
application / config / database.php

$db['default'] = array(
'dsn'   => '',
'hostname' => 'localhost',
'username' => 'DATABASE_USERNAME',//database username here
'password' => 'DATABASE_PASSWORD',//database password here
'database' => 'DATABASE_NAME',//database name here
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

      



Then in the config file application / config / config.php

$config['base_url'] = 'http://example.com/';

      

if you still get the error, can't connect, try checking the username, database name and password and try changing the database password to make sure it's correct

UPDATE
Check the file permission and make sure it's 644

and the folder permission 755


Also check the version php

, mysql

and make sure the version php

is atlease 5.6

or higher and check the requirements for your server infrastructure.

+4


source


Try it, it works for me.



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

      

+3


source


I had the same problem but figured it out.

  • Make sure all database settings are collected. You can try here in index.php (root);

    if (mysqli_connect ('hostname', 'username', 'password', 'database')) {echo 'ok'; }

    if ok then go to .htaccess file.

  • In your .htaccess file, leave this line blank

    RewriteBase /

0


source







All Articles