Hurry! Save Up to 50% On Your Purchase | February 2021 X

How htaccess files work in the PHP CodeIgniter framework?


Sometimes you'll be surprised to see that the homepage is loading properly, and all other pages are showing 404, Not Found error. The most probable reason for this is your server does not support SEO friendly URL.

Please follow the steps to check with the issue.

  1. Verify if a .htaccess file already exists.
  2. If there is no existing file, you will have to create a new dot .htaccess file.
  3. If you can't find it, maybe the file is hidden.
  4. Click on the setting button, and check Show hidden files.
  5. Now, you can see the dot .htaccess file.
  6. Type the code snippet given below here.
  7. This will enable the SEO friendly URL.
  8. Access the page on your browser.
  9. It's now loading.

So, you need a dot .htaccess file to run PHP CodeIgniter, with SEO friendly URL.

Code:

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