set 404 page in codeigniter code example

Example 1: 404 page not found codeigniter

#Ubuntu 18.04
1.Add this in 000-default.conf or sitename.conf inside /etc/apache2/sites-enabled/

    
        	Options Indexes FollowSymLinks
	        AllowOverride All
        	Require all granted
	
    
2. And restart (sudo service apache2 restart)

Example 2: 404 page not found localhost codeigniter

.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$1 [PT,L]
Or

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Tags:

Misc Example