cakephp重定向到routes.php中的外部URL

In Cakephp routes.php, How to redirect to external url eg: http://blog.example.com

Router::connect('/blog','http://blog.example.com/');

This cannot be done with CakePHP. Well actually it could, but you'd better put this in your .htaccess/apache/nginx/whatever server you're using, this is where this kind of thing belongs.

If you really, really, REALLY can't do it that way, you can route /blog to a controller action that will simply redirect.

Config/routes.php
<?php

Router::redirect('/blog/*', 'http://blog.example.com', ['status' => 301]);

Edited with may comment

Router::redirect('/blog/*', 'http://blog.example.com', array('status' => 302));

here is the cakephp reference . http://book.cakephp.org/2.0/en/development/routing.html#redirect-routing