Welcome Guest, Not a member yet? Register   Sign In
Front-end, Back-end and htaccess

I've done a fair amount of searching and I can't seem to find a solution to this problem.

I have the following file structure:

- admin
- site

And of course two php files (index.php and admin.php) both located in the root. The site is working fine, but I am trying to configure my htaccess file so that anything http://www.mysite.com/admin/ will read the admin.php file and ANYTHING ELSE will read the index.php file.

Can anyone help?

Why with htaccess just simply use a controller name admin and load admin.php in index function of this controller.You're done.

I'm not sure the above would work since I'd like http://www.mysite.com/admin/ to act as the root for my 'backend' application.. for example:


I understand I could have a route setup so anything /admin/ automatically points to admin.php's root controller, but I'd prefer to just rewrite it.

You can store controllers into subfolders (1 level deep only).

So you just have to create /controllers/admin/ and place your admin controllers there.

you can use ../../ to load files using view in your case

I think you need something like this:

RewriteEngine On
RewriteRule ^admin/(.*)$ admin.php?$1 [nc,QSA]
RewriteCond $1 !^(index\.php|images|javascript|css|admin)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Thanks missionsix, top one!

Np, glad i could help.

Theme © iAndrew 2016 - Forum software by © MyBB