diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/routing.md | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md index cf828462ce..079fd87a64 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -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. |