Question: Hello stackoverflow community,

I've got a little Problem with my CodeIgniter.
I use two applications in my app folder. The first one is the frontend, the second one the backend.

In my root directory I've two .php files. An index.php leading to the frontend directory and a backend.php leading to the backend directory.

Since I use mod rewrite in order to get clean URL's there is a problem with that. 
The URL structure is the following: www.domain.com/controller/action

That's the action of the controller in my frontend Application.

I use htacces to get rid of the /index.php/ between domain and controller.
To access my backend application I want my URL to be like this www.domain.com/admin/controller/action

therefore I have this rewrite rule:

```
RewriteCond %{REQUEST_URI} ^admin.*
RewriteRule ^admin/(.*)$ /backend.php?/$1 [L]

```

Now the problem:
CodeIgniter assumes that /backend/ is the first URI segment, and wants to treat it mistakenly as my controller.

Do I really have to edit the core of CodeIgniter in order to tell it not to use the Server Request URI or is there another trick?

Thanks in advance,
Thomas

Answer: 
This really isn't going to work. Check out config/config.php and config/settings.php etc for constants that need setting... You really need to run each application in a separate 'application' directory. It's also worth asking yourself if they even need to be 'separate' applications...

Basically, stop going down this path while you still can, it will lead to heartbreak, and reams of horrible code.
Instead of having two application folders I would suggest having a folder within the controller called 'admin', you could also have folders within your `models`, `views` (even `libraries`) named 'admin' which you could then pull out of this project and move to other projects.

This would allow you to just use a standard [`rewrite`](http://codeigniter.com/wiki/mod_rewrite/) to remove the `index.php` from the URL, and `domain.com/admin` would point to your admin folder within the controller.

You just need to be sure not to have a controller within the root controller folder named 'admin.php' or you will run into issues.

For more information take a look at: [Organizing Your Controllers into Sub-folders](http://codeigniter.com/user_guide/general/controllers.html#subfolders) within the CI docs.

Also note that an out of the box MVC framework might not always be best used for creating a CMS. Typically an MVC framework is best used to quickly create web applications which have fairly static `routes` pointing to specific `controllers`. CMS's on the other hand tend to give full control over the website, which leads to database driven routes which often eliminate the need for typical `controllers` unless you have a heavily modified routing system.