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

quick 301 url slash end fix #2280

Open
wants to merge 2 commits into
base: hotfixes
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion oc-includes/osclass/controller/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ function __construct()
if( preg_match('/^index\.php/', $this->uri)>0) {
// search url without permalinks params
} else {
$this->uri = preg_replace('|/$|', '', $this->uri);
// redirect if it ends with a slash NOT NEEDED ANYMORE, SINCE WE CHECK WITH osc_search_url
// dev-101: apparently, we do! In some cases / urls are not redirected!
// quick & dirty test fix (not final!)
if( preg_match('|/$|', $this->uri) ) {
$redirectURL = osc_base_url() . $this->uri;
$redirectURL = preg_replace('|/$|', '', $redirectURL);
$this->redirectTo($redirectURL, 301);
}
$this->uri = preg_replace('|/$|', '', $this->uri);
if(($this->uri!=osc_get_preference('rewrite_search_url') && stripos($this->uri, osc_get_preference('rewrite_search_url') . '/')===false) && osc_rewrite_enabled() && !Params::existParam('sFeed')) {
// clean GET html params
$this->uri = preg_replace('/(\/?)\?.*$/', '', $this->uri);
Expand Down