将 Codeigniter URL 路由到另一个端口
Route Codeigniter URL to another port
我想将 Codeigniter URL 路由到同一域中的另一个端口
所有请求:
http://www.example.com/api/testing
指向:
http://www.example.com:4500/api/testing
这里4500是我使用的端口
我尝试了以下方法,但没有用:
$route['api/(:any)'] = ":4500/api/";
我找到了答案:
只需在 htaccess 中使用:
Redirect "/api/" "http://www.example.com:4500/api/"
无需在CI中设置任何路由。
我想将 Codeigniter URL 路由到同一域中的另一个端口
所有请求:
http://www.example.com/api/testing
指向:
http://www.example.com:4500/api/testing
这里4500是我使用的端口
我尝试了以下方法,但没有用:
$route['api/(:any)'] = ":4500/api/";
我找到了答案:
只需在 htaccess 中使用:
Redirect "/api/" "http://www.example.com:4500/api/"
无需在CI中设置任何路由。