提交 64b5c849 编写于 作者: R Richard Schneeman

Merge pull request #21169 from yui-knk/doc/route_status

[ci skip] Add an explanation for `status` option
......@@ -795,7 +795,11 @@ get '/stories/:name', to: redirect { |path_params, req| "/articles/#{path_params
get '/stories', to: redirect { |path_params, req| "/articles/#{req.subdomain}" }
```
Please note that this redirection is a 301 "Moved Permanently" redirect. Keep in mind that some web browsers or proxy servers will cache this type of redirect, making the old page inaccessible.
Please note that default redirection is a 301 "Moved Permanently" redirect. Keep in mind that some web browsers or proxy servers will cache this type of redirect, making the old page inaccessible. You can use the `:status` option to change the response status:
```ruby
get '/stories/:name', to: redirect('/articles/%{name}', status: 302)
```
In all of these cases, if you don't provide the leading host (`http://www.example.com`), Rails will take those details from the current request.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册