Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing back the default redirect code from 301 to 302. #1619

Merged
merged 1 commit into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions system/config/system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ pages:
etag: false # Set the etag header tag
vary_accept_encoding: false # Add `Vary: Accept-Encoding` header
redirect_default_route: false # Automatically redirect to a page's default route
redirect_default_code: 301 # Default code to use for redirects
redirect_trailing_slash: true # Handle automatically or 301 redirect a trailing / URL
redirect_default_code: 302 # Default code to use for redirects
redirect_trailing_slash: true # Handle automatically or 302 redirect a trailing / URL
ignore_files: [.DS_Store] # Files to ignore in Pages
ignore_folders: [.git, .idea] # Folders to ignore in Pages
ignore_hidden: true # Ignore all Hidden files and folders
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Grav.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function redirect($route, $code = null)
}

if ($code === null) {
$code = $this['config']->get('system.pages.redirect_default_code', 301);
$code = $this['config']->get('system.pages.redirect_default_code', 302);
}

if (isset($this['session'])) {
Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ public function init()
$uri = str_replace($setup_base, '', $uri);
}

// If configured to, redirect trailing slash URI's with a 301 redirect
// If configured to, redirect trailing slash URI's with a 302 redirect
if ($config->get('system.pages.redirect_trailing_slash', false) && $uri != '/' && Utils::endsWith($uri, '/')) {
$grav->redirect(str_replace($this->root, '', rtrim($uri, '/')), 301);
$grav->redirect(str_replace($this->root, '', rtrim($uri, '/')), 302);
}

// process params
Expand Down