Module Routing For Application - php

I have he following url for my codeigniter application and I'm trying to find out how I can view this specific controller with the url. The my-project is what is used for my cms and the "admin" url segment is a variable representing a section of the cms area, "users" is the module from which I need to get the admin.php file for. I am using the wiredesignz 3rd page HMVC plugin into this application.
testsitehere.com/my-project/admin/users
-application
-modules
-users
-controllers
admin.php
I have tried the following route but still received the 404 error page.
$route['my-project/:any/:any'] = '$1/$2/admin';
What am I doing wrong for it to not work?

Try to use brackets:
$route['my-project/(:any)/(:any)'] = '$1/$2/admin';

Related

CodeIgniter index.php 404

I am using CodeIgniter for both frontend and backend. My backend isn't really that complex so it didn't warrant a different installation of CI. What I have now is a sub directory in controllers cms where I have all my backend controllers including a backend Index which extends MY_Backend core. Now I'm working on getting my front end up and running and have come across a problem if I have an Index file in the main controllers directory that extends MY_Frontend core. And try to access it via localhost or localhost/index I get a 404 page. If I change the name and subsequently the class name to Homepage I can access it via localhost/homepage.
Is this possibly due to having an Index file in the cms sub-directory? Otherwise, what is the issue? Here is my directory structure:
As at the base of it all controllers extend CI_Controller, there are 3 naming restrictions in place for controllers:
CI_Controller
Index
Default
Using any of these would cause a problem in some shape or form. I'd suspect this would be why your controller works fine named as Homepage, but not as Index.
Source: https://www.codeigniter.com/user_guide/general/reserved_names.html

Unable to route to controller within subfolder - CodeIgniter

I am new to CodeIgniter.
I am creating an application where I have created controllers within sub folders.
Demo
-Application
-Controllers
- Home
-Left
-Right
-Main
In routes.php, I have added below line.
$route['Left/(:any)'] = 'Home/Left/$1';
This is the URL I am trying to access.
http://localhost/Voyager/left/main
I am getting "404 Page Not Found error".
Is there something else I need to add or change?
Thanks for help.
I found the answer myself.
Issue was that I had another controller in controller folder with name Home, which was causing issue. Renaming that solved the issue.

how to create module inside module in codeigniter

I have implemented HMVC for creating modules in codeigniter . Now I want to create modules inside module but unfortunately I am getting 404 page.
My current directory structure
modules/api/v1
when I am putting controller inside api/controller folder then it's working fine but when I put a controller file under api/v1/controller folder then it showing me 404 error. I want this because after implementing this all the version of my api will be inside a single folder
Please give me your suggestion how can I do This

Unable to access controllers of codeigniter which is installed under a wordpress site

I have a Wordpress site. So all i wish is to fetch the information from those database tables and create my own custom API's. For that i opted CodeIgniter Framework.
The file directory system looks like this in my FTP
My codeigniter files are placed in apps folder
The problem is the pages are not loading, It always returns 404 Error
or No Input file specified/found etc.
I tried changing .htaccess file but no luck.
But if i specify
applications/apps
i.e controller/method in default_url in routes.php it works fine.
and if i click on the Hyperlink, i am trying to load another view or call another View(a web page) but this returns 404 error page not found.
What might be the reason behind this.

How to Use Module Controllers in Kohana 3?

For the following application directory structure under / in Kohana 3:
application
classes
controller
controller1.php
modules
admin
classes
controller
controller2.php
And the urls be: /controller1 and /admin/controller2?
I seem to be missing something though because I keep getting a 404 error with the /admin/controller. What am I doing incorrectly?
The exact error is:
HTTP_Exception_404 [ 404 ]: The requested URL admin/borrowers was not found on this server.
And I don't have any custom routes setup. This is a very vanilla K3 install at this point.
The directory structure seems to be a little of.
Using a module doesn't automatically means you have a subdirectory. The default route defines the following url structure:
/[controller]/[action]
So for the directory structure that you have given, you get the following:
/controller2/
The action can be left out, but it will default to index.
If you want a special admin subdirectory, you would first have to create that subdirectory in you modules classes directory like this:
/admin/classes/admin/controller2.php
Then you would have to add another route that handles the subdirectory. You can find more information about that in the userguide

Categories