I am working quite closely with Codeigniter the PHP framework:
http://www.codeigniter.com/
Now I've added this Modular Extensions – HMVC to my Codeigniter framework.
https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/overview
Now, I've created my own module in the modules folder and set up directories for controllers, models and views as instructed. However I'm struggling specifically with custom routing.
I have created the config directory in my module blog directory and I have created the routes.php file within.
Now to access my module in the browser i would go to localhost:8888/blog/
now I'm mostly asking out of curiosity, I wanted to create a custom route so that maybe I could access the page like localhost:8888/posts/
so I thought that setting up the following route would work:
$route['posts'] = 'blog';
or if I had a method called listings I could use
$route['posts/listings'] = 'blog/listings';
However this returns a 404 Page Not Found
.
Is it possible to create custom routes like this in a module?
Best Answer
Setting up custom routes for HMVC Easy here are some examples below. You can use same techneique for CI3 Make sure you choose right version from here https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/downloads go to branches and choose your version The Default is for CI-2
For Example:
admin will be module name.
Please watch this great tutorial for beginners on HMVC https://www.youtube.com/watch?v=8fy8E_C5_qQ
You can also download Htaccess from here http://www.insiderclub.org/downloads you may need to join for free to download David's Insider Club suitable for codeigniter.