Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

754
Views
Remove index.php from codeigniter project on localhost and apache server

I have a project in CodeIgniter that I am running on my local machine on LocalHost. I have to use http://localhost/projectname/index.php/controller/function to run my APIs. I want to access the same URL but without including index.php in the URL.

Earlier I had XAMPP installed and I was using its htdocs folder and everything was functioning as required. But now I have uninstalled it and manually set up Apache 2.4, PHP 8, and MySQL 8. After doing so, there is this issue.

I am new to both manually setting up servers and CodeIgniter. Please help me fix this and if possible give a reason why this happens, it will help me learn.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Add a .htaccess in the root directory and then add the following rules to the .htaccess file

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

Then find the following file in your application. File Path is application/config/config.php. In this file find below the code

$config['index_page'] = 'index.php';

Change that line as below.

$config['index_page'] = '';

Now try to open URLs without index.php.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!