我正在建立一个 URL 缩短器网站。
这是我的config/routes.php
文件:
$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";
好吧,如您所见,我实现了 CI Wiki 中提到的语言。
但是现在最后一行路线无法正常运行。
$route['(:any)'] = "url/go/$1";
例如,myshortner.com/as34v
应该与上面的路由匹配并重定向到完整的 URL,但它会重定向到0.0.0.1
! 我怎样才能解决这个问题?