Tank_Auth With Code Igniter Giving 404 on registration-success - php

I'm working with CodeIgniter and Tank_Auth. I got the registration to work, but it looks like it's trying to load registration-success, and I'm not sure where that is.
In auth.php on line 239 I have
$this->tank_auth->notice('registration-success');
I see a registration-success.php in views/landing/registration-success.php. Is this the page it's trying to access? I'm getting a 404 when I submit a successful registration (I can see the user created in the db).
EDIT:
After resetting and updating my routes.php file, I see that I'm getting a 404 page not found error while the url in the browser points to index.php/auth. Is there something I'm supposed to route in order for this to work?
Currently I have the following in my routes.php:
$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['login'] = "/auth/login";
$route['logout'] = "/auth/logout";
$route['register'] = "/auth/register";

I am looking at TA library and I don't see any notice() method or function. Also in auth.php (fresh download) I did not find any lines that contain "notice".
Also note
that you have two $route['default_controller'] in your routes.php.
that routing in CodeIgniter is prioritized.
Your config/routes.php should look like.
$route['default_controller'] = "pages/view";
$route['404_override'] = '';
$route['login'] = "/auth/login";
$route['logout'] = "/auth/logout";
$route['register'] = "/auth/register";
$route['(:any)'] = 'pages/view/$1';
see the last line ? it uses a "wild card", you had problem with that line because, it grabbed eg. localhost/project/login and "redirected" (routes do not redirect) to localhost/project/pages/view/login terefore you got 404

Related

how to define route in codeigniter i am trying but it not working

$route['default_controller'] = 'Student';
$route['admin'] = 'index.php/Admin_depart/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
I am fairly new to CodeIgniter and finishing up my first project. However, before I put it up on my hosting site I would like to clean up the URL's using the routes.php file that CodeIgniter provides in the config folder. but it is not working it work correctly when i write same url i the default_controller
The index.php is causing the issue.
Route destinations must be defined only as a controller/method pair. So in your case the correct route would be:
$route['admin'] = 'Admin_depart/index';
anyone browsing to yoursite.com/admin would be served whatever is in your Admin_depart controller, index method (just as if he/she browsed directly to yoursite.com/admin_depart/index;

Issue routing code igniter

Hey I am having an issue routing to my other controllers in codeigniter.
Basically this is my base url http://localhost:8012/CodeIgniterProject/
This works fine but every time I type something after it I get an object not found error. I am trying to route to my Dashboard.php controller but having no luck. I want to type http://localhost:8012/CodeIgniterProject/dashboard and hit the Dashboard controller.
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['home/(:any)'] = "dashboard";
$route['(:any)'] = "";
$route['404_override'] = 'dashboard';
$route['Dashboard'] = "dashboard";
$route['about'] = "site/about";
I know this might be simple to other people but I don't usually work in php and this has me a little stumped. I was under the impression codeigniter would pick up dashboard from my controllers folder and got to my controller class to load it? And then if I wanted to pass params to the class etc I'd just need to add e.g /123??? Thanks for your time.
define method too, like:
$route['Dashboard'] = "dashboard/index";

redirect with route on codeigniter

I am trying to routing the url to some Controllers that are in different folder than the url show... I think it is better an example, I have something like this:
$route['admin'] = 'admin/admin';
$route['admin/register'] = 'admin/login/register';
$route['admin/newuser'] = 'admin/login/newuser';
$route['admin/logout'] = 'admin/login/logout';
$route['admin/login'] = 'admin/login';
$route[''] = 'admin/admin';
All of them are working, but last. What I want to do is that someone type www.mydomain.com the system use the controller admin (placed on the folder admin), but I am getting a 404 always.
A fast, but not elegant solution I am thinking (but I wouldn´t want to do) is modifying the 404 file and test if there is no segment, and then redirect.
Any other idea?? Thank you.
You must set default controller for default page when user click you page
$route['default_controller'] = "admin";
it's set your default view for homepage
Step 1: Remove $route[''] = 'admin/admin';
Step 2:
In order to redirect to admin/admin when the user type URL www.mydomain.com, then you should do like this:
$route['default_controller'] = 'admin/admin';
Then it will redirect to admin controller and admin method if no controller after www.mydomain.com.
Have nice routing!
In config/routes.php
$route['default_controller'] = 'admin';
$route['404_override'] = 'admin';
When 404 occur it will load method which you provide in $route['404_override'].

How to remove the controller name from url in codeigniter, and still be able to redirect on another controller?

I'm building an website using Codeigniter and I've changed the way the URL looks from http://localhost/site_controller/home to http://localhost/home.
I've changed that by using .htaccess -> RewriteBase
changing the $config['index_page'] to $config['index_page'] = '';
and in routes I've change like that:
$route['default_controller'] = "site";
$route['(:any)'] = "site/$1";
And it works fine only for the site controller, BUT my problem is that I have another controller named admin and when I try to login and make a redirect using redirect('admin/index') I get a 404 error.
How can I redirect from site controller to admin controller?
If you are going to route from (:any) => site you have to specify a higher priority route for the admin controller that overrides that route for those pages.
$route['default_controller'] = "site";
$route['admin/(:any)'] = "admin/$1";
$route['(:any)'] = "site/$1";

routes.php and controllers (codeigniter)

I have two controllers
1- site
2- management
the first controllers(Site) is work successfuly
the second controllers(Managemnt) is not work.
I don't know what is the errror
I change the routes.php but still doesn't work(managment)
$route['default_controller'] = "site";
$route['(:any)'] = "site/$1";
$route['Administration'] = "Administration/index";
$route['Administration/([a-z])'] = 'Administration/$1';
this links work:
example.com/hotel/12312
example.com/contact
example.com/city/newyork
example.com/Administration
but this links doesn't works:
example.com/Administration/hotels
example.com/Administration/add_new
example.com/Administration/cities
where is the problem pls because I tired to solve this problem
thaks
It has to do with the order in witch you are giving route directives.
Code igniter routes requests from top to bottom, so if you want your $route['Administration'] to precede $route['(:any)'] you have to set it first.
$route['default_controller'] = "site";
$route['Administration/([a-z])'] = 'Administration/$1';
$route['Administration'] = "Administration/index";
$route['(:any)'] = "site/$1";
I would allways sugest putting (:any) routes at the end so they don't overwrite more specific routes.
I had same problem & I get this working:
$route['default_controller'] = "welcome";
$route['([a-z-A-Z1-9_]+)'] = "site";
$route['management']="management";
$route['404_override'] = '';
it may help you!
I'm not familiar with Codeigniter routing, but to me looks like everything is matching $route['(:any)'] = "site/$1"; before it ever reaches your Administration routes. Try moving it below everything else...you might also have to switch your Administration routes for the ([a-z]) to match
$route['default_controller'] = "site";
$route['Administration/([a-z])'] = 'Administration/$1';
$route['Administration'] = "Administration/index";
$route['(:any)'] = "site/$1";

Categories