»
S
I
D
E
B
A
R
«
CodeIgniter Backend Frontend .htaccess router
November 8th, 2009 by wood

Hi, I'm trying to develop a little base CMS with CodeIgniter for my own use on projects but got stuck on this. Also, I'm very new to CI, but got some years with ZF and OOP PHP.

First of all let me show you my file structure:

  • index.php (frontend bootstrap)
  • backend.php (backend bootstrap)
  • .htaccess
  • system ( CI core )
    • application
      • backend
        • [...] MVC related files and folders (config, controllers, models, views...)
      • frontend
        • [...] MVC related files and folders (config, controllers, models, views...)
    • codeigniter
    • [...] (cache, database, scaffolding...)

Ok. I can get to work the index.php or backend.php routing with an .htaccess, but can't get it to work with both. Here's the .htaccess code:

RewriteEngine on
RewriteBase /

# Hide the application and system directories by redirecting the request to index.php (and throwing a 404 error)
RewriteRule ^(application|system|\.svn) index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [QSA,L]

Well, what I need is the following:

  • www.domain.com/backend/controller/action/parameters (backend.php routing)
  • www.domain.com/controller/action/parameters (index.php routing)

Hope I explained well.

Can anyone help, please? :)

Best regards.


2 Responses  
  • Manzoor Husain writes:
    January 23rd, 2010 at 8:52 am

    Hello,I am Manzoor Husain.
    I am stuck in something.

    Sir,Can you please tell me How to Hide the “function name” in “url” in “codeigniter”.

    For example the name of my folder I am working on is “VCB_project” when I click the folder I see “http://localhost/VCB_project/ “ and I want to keep this url(http://localhost/VCB_project/) though out the application.

    That means when a I click for another application Create A New Account then the url becomes (http://localhost/VCB_project/VCB/New_account) but I do not want to show my Controller Name(VCB) and Function Name(New Account) .

    I want to see show http://localhost/VCB_project/ after clicking the
    Create A New Account .

    Please send me a reply as soon as you get the information.

    Sincerely Manzoor Husain

  • Abdul Rahman writes:
    February 12th, 2010 at 7:04 am

    Hello, I am Abdul Rahman.
    I am also stuck in something.

    Can Some Sir Please Tell me why my “code” “redirect(’mosque’, ‘locaction’, ‘404′);” gives a “blank” page.

    Please send me a reply as soon as you find the information.

    Thank You Very Much, Abdul Rahman.


Leave a Reply

»  Substance: PHP Frameworks   »  SiteMap