My current urls look like this [mysite]index.php/[rest of the slug]
.
I want to strip index.php
from these urls.
mod_rewrite
Well these all answers are good but for a newbie(which is do first time) these are confusing. There are other htaccess files which is reside in controller but we have to edit or add the htaccess in main project folder.
This is your codeigniter folder, where file resides like application,system,assets,uploads etc.
Your_project_folder/
application/
assets/
cgi-bin/
system/
.htaccess---->(Edit this file if not exist than create it)
index.php
Change this file as written below:
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at http://www.example.com/mypage/test1
# then use RewriteBase /mypage/test1/
# Otherwise /
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: Anand Pandey
ErrorDocument 404 /index.php
and yes of course you need to change two lines of code in the application/config/config.php
//find the below code
$config['index_page'] = "index.php";
$config['uri_protocol'] ="AUTO"
//replace with the below code
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";