Welcome Guest, Not a member yet? Register   Sign In
codeigniter htaccess for multiple applications
#1

[eluser]cloud2681[/eluser]
Hi all

I currently have an issue with multiple applications method.
I have split my website into 2 applications my site structure is

Code:
application/
         admin/
         frontend/
system/
index.php (points to frontend)
admin.php (points to admin)


i have done a clean install with admin simply a copy of index with the application pointed to application/admin

all i want to do is change the admin.php to just
admin/controller/function
but no matter what i try i can not do a mod_rewrite for it, i had it working perfect for index so i just changed the names to admin and it didnt work

My question is is there a way to do this using Mod_rewrite?

thank you for any replies
#2

[eluser]sv3tli0[/eluser]
Code:
application/
         controller/
         controller/admin/
         models/
         models/admin/
         view/
         view/admin/
system/
www/index.php (points to frontend)

Just make admin folders in controller / models / view folder Smile
And perhaps you can set your index.php in a www folder Smile (if so, you have to fix app/sys folder paths.
#3

[eluser]cloud2681[/eluser]
I currently planning on building this project using modules the HMVC way so i ideally want this separated, so i can easily remove the admin for other projects.
#4

[eluser]sv3tli0[/eluser]
.. CI is MVC not HMVC which is your problem..

Perhaps you may make one little "trick"..

At index.php

Go To:
Code:
$application_folder = 'application';

And make something as....

Code:
if( mb_strtolower( mb_substr( $_SERVER["REQUEST_URI"], 1, 5, "UTF-8" ), "UTF-8" ) === "admin" ){
   $application_folder = 'application/admin';
} else {
   $application_folder = 'application/frontend';
}

And 1 idea from me is to create www folder where to put your index.php and all public files ..
In that case you will have to update your sys/app paths with ../ infront Smile
#5

[eluser]cloud2681[/eluser]
cool this looks promising ill give this a go. and there is a way to get Codeignighter to perform a HMVC architecture as i already have this working Wink
#6

[eluser]cloud2681[/eluser]
Dont think this will work actually because when admin is typed this will direct away from index which then cannot process this statement?
#7

[eluser]sv3tli0[/eluser]
This is a trick to select CI Application ...
How ever any routes from frontend with /admin/ will fail!
/admin
#8

[eluser]cloud2681[/eluser]
Sorry sv3tli0 im a little lost i tried your suggestion and it just showed a 404. i have got it working to with admin.php but why wont a simple mod_rewrite work on admin.php just like it does for the index.php
#9

[eluser]sv3tli0[/eluser]
Ok.. with little search here is working way : http://philsturgeon.co.uk/blog/2009/07/C...odeIgniter
#10

[eluser]cloud2681[/eluser]
doesn't tell me how to do it, although i just solved a work around incase anyone else has this issue this is what i did.
my file structure
Code:
application/
         admin/
         frontend/
admin/
         index.php (points to ../application/admin/)
         .htaccess ( this removes index.php)
index.php (points to application/frontend/)
.htaccess

this worked for me now i have clean URLS for admin and both applications are nicely divided




Theme © iAndrew 2016 - Forum software by © MyBB