Codeigniter 4 Setup

Website URL

(please specify the URL of the site on which you are experiencing the problem)

500 Internal Server Error

(please share the FULL error message you see, if applicable)

Something on the website crashed!

(other information and details relevant to your question)

I already can access the index page when I type well whenever I click on the buttons that redirects to a controller or webpage, it shows me the error 500 Internal Server Error Something on the website crashed!. Can anyone help me

Hi and welcome to the forum! Check your .htaccess file for any lines that give an error and if any, remove them.

# Disable directory browsing
Options -Indexes

# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
	Options +FollowSymlinks
	RewriteEngine On

	# If you installed CodeIgniter in a subfolder, you will need to
	# change the following line to match the subfolder you need.
	# RewriteBase /
    RewriteRule (.*) /public/$1 [QSA,L]

	# Redirect Trailing Slashes...
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_URI} (.+)/$
	RewriteRule ^ %1 [L,R=301]

	# Rewrite " ->"
	RewriteCond %{HTTPS} !=on
	RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
	RewriteRule ^ http://%1%{REQUEST_URI} [R=301,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 the front controller, index.php
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]

	# Ensure Authorization header is passed along
	RewriteCond %{HTTP:Authorization} .
	RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

<IfModule !mod_rewrite.c>
	# If we don't have mod_rewrite installed, all 404's
	# can be sent to index.php, and everything works as normal.
	ErrorDocument 404 index.php

# Disable server signature start
	ServerSignature Off
# Disable server signature end

I don’t know which code can cause error tbh

So my real problem is that whenever I call a controller it always shows me the error message " 500 Internal Server Error"

Try to uncomment RewriteBase / or move the .htaccess file from the public directory to the htdocs folder and see if it works.


When I move the .htaccess to the htdocs it errors 505. the RewriteBase did not also work

hey there @JxstErg1 I solved it. So I research and I added this line of code to my .htaccess file and it magically worked

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

thank you for your time @JxstErg1. god bless you :))


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.