Skip to content

Instantly share code, notes, and snippets.

@notomato
Created December 4, 2013 04:28
Show Gist options
  • Save notomato/7782351 to your computer and use it in GitHub Desktop.
Save notomato/7782351 to your computer and use it in GitHub Desktop.
Lithium, handling redirects in route config
// Permanent redirect of old product URLs.
Router::connect('/productdetails/{:id}', [], function($request) {
return new lithium\action\Response([
'location' => ['Products::view', 'id' => $request->params['id']],
'status' => 301
]);
});
// Permanent redirect of old user files
Router::connect('/userfiles/{:path}', [], function ($request) {
return new lithium\action\Response([
'location' => '/files/' . $request->params['path'],
'status' => 301
]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment