Skip to content

Instantly share code, notes, and snippets.

@AoJ
Created March 20, 2012 19:52
Show Gist options
  • Save AoJ/2140579 to your computer and use it in GitHub Desktop.
Save AoJ/2140579 to your computer and use it in GitHub Desktop.
Redirect from old domain to new domain
<?php
$container->router[] = new Route('//old.nette.local/<path>', array(
'path' => array(
Route::PATTERN => '.*',
Route::FILTER_OUT => NULL,
),
'presenter' => 'Nette:Micro',
'callback' => function() use($container) {
$url = clone $container->httpRequest->url;
$url->setHost('new.nette.local');
return new \Nette\Application\Responses\RedirectResponse((string)$url, \Nette\Http\IResponse::S301_MOVED_PERMANENTLY );
}
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment