• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Admin App

#1
Hi there . I'm new to ci enviroment  and i have some questions to some more experienced users .
Is there any chance to have separate admin app folder and logic like wordpress does ? 
Separate routes frontend from backend ?
loading routes per  first uri segment? 

Right now i've installed ci4 and moved index.php and htacces file back into root  folder , added admin foder(custom script not related to ci4) i can acces  backend and everything works fine there (not loading any  ci4 classes ).
yoursite .com /codeiniter/admin/index.php?page=settings&do=permalinks 
front end works fine .. but doesn't seems to be the right way to do it .
working on xampp localhost so /codeigniter folder it's a must,  no virtual host added.
Thanks !

Code:
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    # If you installed CodeIgniter in a subfolder, you will need to
    # change the following line to match the subfolder you need.
    # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
    RewriteBase /codeigniter/

    # Redirect Trailing Slashes...
   RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Rewrite "www.example.com -> example.com"
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

    # Checks to see if the user is attempting to access a valid file,
   # such as an image or css document, if this isn't true it sends the
   # request to the front controller, index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /codeigniter/index.php/$1 [L]

    # Ensure Authorization header is passed along
   RewriteCond %{HTTP:Authorization} .
   RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Reply

#2
Mapping your website to your project route is not a secure practice!
XAMPP supports virtual hosting, so there should be no problem there.

You could always use a subdomain, eg http://www.yoursite.com and admin.yoursite.com, if you want to keep them separate.
They could still share a CodeIgniter folder.

There is nothing wrong with having an admin folder inside app/, with nested Controllers folders etc.
You could setup routes to suit the URIs you want to see.
Not sure if that is what Wordpress does or not.
This is closest to what has been called "HMVC" in CodeIgniter 3.

There is also nothing wrong with having an admin folder inside app/Controllers, with some form of role-based access so that functionality is only usable by someone in an "admin" role.
Reply

#3
Hi

If your going to make the admin backend in codeigniter then thats what the modules folder is for if I'm not mistaken, use the app folder for the frontend for normal users, then create a /modules/admin, and duplicate the folder structure from the main app inside it (it has to have PSR4 namespaces), setup your app/config/autoload.php file. It's in the manual.

Failing that, use virtual hosting as has been suggested. If your using Windows I,ll walk you through it, it's fairly easy.

Hope that helps.
Reply

#4
Hy. Thanks for your replay . I don't wanna load 60-70 admin routes for every front request . I already have user defined routes in database for every front request redirecting to app routes . Ill try yii framework aproach redirecting from htacces to admin or front from root or get first segment in public index and load addmin or app based on first segment
Reply

#5
Hmmm yes you are right . A catch all single admin route and do the logic in controller
Reply

#6
Route Groups
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.