Welcome Guest, Not a member yet? Register   Sign In
HMVC - renaming module through routes
#1

[eluser]Unknown[/eluser]
Hi Everyone,

I have a module named 'modulemanager' but rather than having my client typing that long name, i want them to type adm. Now I figure that if I simply change my module name to 'adm', all issues will be resolved but I want to be able to share, add/import modules with other friends/developers and then simply change it's access using routes, rather than renaming the folder.

Here's what I have so far.

/config/routes.php
Code:
$route['^(?!'.MODULE_LIST.').*'] = "lazyload/$0";
$route['adm'] = 'modulemanager/index';
$route['adm/(:any)'] = 'modulemanager/$1';
$route['default_controller'] = 'lazyload/index';
$route['404_override'] = "";

/modules/modulemanager/config/config.php
Code:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI'

/.htaccess
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

The above allows me to access http://localhost/fishbone/adm but when try to access my login controller http://localhost/fishbone/index.php/adm/login I get a 404 error. If I change form action to the module's full name (http://localhost/fishbone/index.php/modulemanager/login) I actually get a error, showing that my login controller was accessible.

I was hoping if someone can help me shed some light into my problem. I was wondering if I should simply rename my module or maybe you can see what my htaccess file is missing or what other config I am missing in my application for /adm/login to be accessable.

Thanks.

Ps.

Just one more note, the main reason why I want to change their name via routes is let's say there are two modules with a similar name, modulemanager and module-manager or simple-module-manager, no matter which one I use or which one I try, I want to control their access through my route definition.





Theme © iAndrew 2016 - Forum software by © MyBB