I am building a URL shortener web site.
Here is my config/routes.php file:
$route['default_controller'] = "main";
$route['404_override'] = '';
$route['(\w{2})/(.*)'] = '$2';
$route['(\w{2})'] = $route['default_controller'];
$route['join'] = 'main/join';
$route['activate/(:any)'] = "main/activate/$1";
$route['login'] = 'main/login';
$route['logout'] = 'main/logout';
$route['main/login'] = 'main/login';
$route['main/join'] = 'main/join';
$route['url/short'] = 'url/short';
$route['user'] = 'user/index';
$route['user/index'] = 'user/index';
$route['user/index/(:num)'] = 'user/index/$1';
$route['profile'] = 'user/profile';
$route['user/delete/(:any)'] = "user/delete/$1";
$route['(:any)'] = "url/go/$1";
Well, as you see, I implemented language as mentioned on CI Wiki here.
But now the last line of route is not functioning normally.
$route['(:any)'] = "url/go/$1";
For example, myshortner.com/as34v should match with above route and redirect to full URL, but instead it redirects to 0.0.0.1 ! How can I fix this?
First you shoulf have a URL controller with a “go” function that takes a parameter held in $1. Make sure that exists.