Documentation
An old address. A new home.
Sometimes a page moves. An exact-path redirect is usually all you need.
Put your old and new addresses in redirects.php. Here is this site’s actual file:
<?php
return [
'/hello' => '/examples/hello',
'/temporary-hello' => ['to' => '/examples/hello', 'status' => 302],
];
The starter includes two example redirects: /hello (301) and /temporary-hello (302). Both lead to this page.
Just a few rules.
- A string destination means a permanent 301 redirect. Use
['to' => '/new', 'status' => 302]for a temporary move. - Sources match the complete decoded path, exactly and case-sensitively.
/oldand/old/are different sources. - Query strings don’t affect matching. Incoming query parameters are discarded; include a fixed query in the destination if needed.
- Destinations can be local paths or complete
https://orhttp://URLs. Local paths use the configured base path. - A redirect takes precedence over a page at the same address.
- 301 and 302 can change POST into GET in browsers. Use them for moved page addresses, not form submission forwarding.
Small on purpose.
No patterns, regex, wildcard domains, or rewrite language. Keep this file empty if you don’t need it. Cornerstone detects local cycles, including cycles through its page aliases. It doesn’t follow external destinations to check them.
Browsers can cache permanent redirects. Use 302 while trying a destination, then switch to 301 once it’s right.