1

I am new to CodeIgniter and trying to understand the basics and maybe some advance methods to set an MVC based application. After a while I thought i might get a try to set a admin panel as well and created and second folder as admin application.

This is my folder structure:

www.domain.com
    --frontend
    --admin

In each folder is an app set with it's own .htaccess file. Bellow is the .htaccess file for admin side.

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

Current working url is www.domain.com/admin/index.php/admin/posts and I am trying pointless to change it to www.domain.com/admin/posts. So how do I remove the /index.php/admin from url.

The $config['base_url'] is set accordingly for each side(admin/frontend) and the default index.php is set null also , $config['index_page'] = '';

Is this the problem cause I have 2 different apps or just a bad configuration? What is the best practice with multiple applications same site?

Hope i did not duplicated any post and if so please don't hate and try to help me. I am deeply grateful to all of you.

Dinca Adrian
  • 1,190
  • 11
  • 21
  • How many times I have to add its removing "index.php/controller" not just "index.php". Why people don't even read the post and they downvote. i have tried several fixes from those posts and none worked... – Dinca Adrian Jun 01 '15 at 09:50

1 Answers1

1

Try this

in config.php

$config['base_url'] = '';
$config['index_page'] = '';

in .htacess

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

EDIT 01

<link href="<?php echo base_url(); ?>css/style.css" rel="stylesheet" />
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
  • I need the $config['base_url'] = ''; to be set because I have css/js files linked in views and the code given was already tested, no effect. Thanks for answer though. – Dinca Adrian Jun 01 '15 at 08:53
  • you need to load css?? So problem with loading CSS?? – Abdulla Nilam Jun 01 '15 at 08:58
  • There is no problem. I just want to improve the app by removing the index.php/controller. The css is loaded by calling the $config['base_url'] . '/css/style.css'. And by changing the $config['base_url'] I wont be able to get the css/js...I need another solution just with .htsccess or with css path fix ideas also... – Dinca Adrian Jun 01 '15 at 09:47
  • will get me back nothing so css/style.css is not valid path. that's the way i am using it right now... – Dinca Adrian Jun 01 '15 at 09:52
  • example ``. **No / before css** – Abdulla Nilam Jun 01 '15 at 09:54