0

Folders Structure:

I have two apps in my application folder: application/admin And application/client

And two index files in the codeigniter root directory: index.php ( for client app ) And admin.php ( for admin app )

.htaccess rules:

Rule for index.php (client)

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

Rule for admin.php (admin)

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^admin/(.*)*$ admin.php/$1 [R=301,L] 

Issue:

There is issue in admin part.
When i write URL like
http://localhost/sandbox/admin/admin-controller-name

its route to admin app but the URL structure become like
http://localhost/sandbox/admin.php/admin-controller-name

I want to display my admin URL like
http://localhost/sandbox/admin/admin-controller-name

1
  • what comes on here admin-controller-name Commented Nov 12, 2015 at 5:44

1 Answer 1

0

In routes.php

$route['admin/admin-controller-name'] = 'admin'; 

In here

$route['admin/admin-controller-name'] we define how URL look like
= 'admin' This actually path of your Controller

Sign up to request clarification or add additional context in comments.

7 Comments

For this URL admin/admin-controller-name Then .htaccess following rule become true RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^admin/(.*)*$ admin.php/$1 [R=301,L] and then the url become admin.php/admin-controller-name I want to remove the .php, just show admin
give me example URL what you expect as answer
My url should display like this localhost/admin/controller/method instead of localhost/admin.php/controller/method There are two apps in my application folder application/client application/admin admin.php is index file for admin app and index.php is a index.file for client app both files are in root directory
So define your cotroller inside admin folder. In ther oastr your controller. So it will show as yours
i have controllers in my admin controller folder lets say dashboard controller it redirects to dashboard controller but the url is display this one localhost/admin.php/dashboard/index
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.