php.htaccesscodeigniterroutescodeigniter-url

Route Codeigniter URL to another port


I want to Route Codeigniter URL to another port on the same domain

All request towards:

http://www.example.com/api/testing

are pointed to:

http://www.example.com:4500/api/testing

Here 4500 is the port i'm used

I tried with the following, but not working:

$route['api/(:any)'] = ":4500/api/$1";

Solution

  • I found the answer:

    simply use in htaccess:

    Redirect "/api/" "http://www.example.com:4500/api/"
    

    No need to set any routes in CI.