I am doing a project in CodeIgniter 3. I need to remove index.php
from url. For that help me to get .htaccess
file for CodeIgniter 3 and also where to place this file.
This is my baseurl
http://cableandmedia.com/demo/
Show activity on this post. change your controller function name as you like. public function addcar($value='') { # code... } public function deletecar($value='') { # code... }
Routing rules are defined in your application/config/routes. php file. In it you'll see an array called $route that permits you to specify your own routing criteria. Routes can either be specified using wildcards or Regular Expressions.
Update your htaccess file with the below code
RewriteEngine On
RewriteBase /demo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
and in config file, please change base url with below code:-
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With