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

[eluser]Sceneshift[/eluser]
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:

Code:
application
- admin
- site
system

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?
#2

[eluser]Yash[/eluser]
Why with htaccess just simply use a controller name admin and load admin.php in index function of this controller.You're done.
#3

[eluser]Sceneshift[/eluser]
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:

http://www.mysite.com/admin/controller/method/

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.
#4

[eluser]gon[/eluser]
You can store controllers into subfolders (1 level deep only).

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

[eluser]Yash[/eluser]
you can use ../../ to load files using view in your case
Code:
$this->load->view('../../application/admin')
#6

[eluser]missionsix[/eluser]
I think you need something like this:

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

[eluser]Sceneshift[/eluser]
Thanks missionsix, top one!
#8

[eluser]missionsix[/eluser]
Np, glad i could help.




Theme © iAndrew 2016 - Forum software by © MyBB