protected function canonicalRedirectRewriteRoutesStrategy () {
		/** @var $request \MvcCore\Request */
		$request = & $this->request;
		$redirectToCanonicalUrl = FALSE;
		$defaultParams =  $this->GetDefaultParams() ?: [];
		list($selfUrlDomainAndBasePart, $selfUrlPathAndQueryPart) =  $this->currentRoute->Url(
			$request, $this->requestedParams, $defaultParams, $this->getQueryStringParamsSepatator(), TRUE
		);
		if (mb_strpos($selfUrlDomainAndBasePart, '//') === FALSE)
			$selfUrlDomainAndBasePart = $request->GetDomainUrl() . $selfUrlDomainAndBasePart;
		if (
			mb_strlen($selfUrlDomainAndBasePart) > 0 && 
			$selfUrlDomainAndBasePart !== $request->GetBaseUrl()
		) {
			$redirectToCanonicalUrl = TRUE;
		} else if (mb_strlen($selfUrlPathAndQueryPart) > 0) {
			$path = $request->GetPath(FALSE);
			$requestedUrl = $path === '' ? '/' : $path ;
			if (mb_strpos($selfUrlPathAndQueryPart, '?') !== FALSE) {
				$selfUrlPathAndQueryPart = rawurldecode($selfUrlPathAndQueryPart);
				$requestedUrl .= $request->GetQuery(TRUE, FALSE);
			}
			if ($selfUrlPathAndQueryPart !== $requestedUrl) 
				$redirectToCanonicalUrl = TRUE;
		}
		if ($redirectToCanonicalUrl) {
			$selfCanonicalUrl = $this->Url($this->selfRouteName, $this->requestedParams);
			$this->redirect($selfCanonicalUrl, \MvcCore\IResponse::MOVED_PERMANENTLY);
			return FALSE;
		}
		return TRUE;
	}
protected function canonicalRedirectRewriteRoutesStrategy () {
		/** @var $request \MvcCore\Request */
		$request = & $this->request;
		$redirectToCanonicalUrl = FALSE;
		$defaultParams =  $this->GetDefaultParams() ?: [];
		list($selfUrlDomainAndBasePart, $selfUrlPathAndQueryPart) =  $this->currentRoute->Url(
			$request, $this->requestedParams, $defaultParams, $this->getQueryStringParamsSepatator(), TRUE
		);
		if (mb_strpos($selfUrlDomainAndBasePart, '//') === FALSE)
			$selfUrlDomainAndBasePart = $request->GetDomainUrl() . $selfUrlDomainAndBasePart;
		if (
			mb_strlen($selfUrlDomainAndBasePart) > 0 && 
			$selfUrlDomainAndBasePart !== $request->GetBaseUrl()
		) {
			$redirectToCanonicalUrl = TRUE;
		} else if (mb_strlen($selfUrlPathAndQueryPart) > 0) {
			$path = $request->GetPath(FALSE);
			$requestedUrl = $path === '' ? '/' : $path ;
			if (mb_strpos($selfUrlPathAndQueryPart, '?') !== FALSE) {
				$selfUrlPathAndQueryPart = rawurldecode($selfUrlPathAndQueryPart);
				$requestedUrl .= $request->GetQuery(TRUE, FALSE);
			}
			if ($selfUrlPathAndQueryPart !== $requestedUrl) 
				$redirectToCanonicalUrl = TRUE;
		}
		if ($redirectToCanonicalUrl) {
			$selfCanonicalUrl = $this->Url($this->selfRouteName, $this->requestedParams);
			$this->redirect($selfCanonicalUrl, \MvcCore\IResponse::MOVED_PERMANENTLY);
			return FALSE;
		}
		return TRUE;
	}
protected function canonicalRedirectRewriteRoutesStrategy ( ) { /** @var $request \MvcCore\Request */ $ request = & $ this -> request ; $ redirectToCanonicalUrl = FALSE ; $ defaultParams = $ this -> GetDefaultParams ( ) ? : [ ] ; list ( $ selfUrlDomainAndBasePart , $ selfUrlPathAndQueryPart ) = $ this -> currentRoute -> Url ( $ request , $ this -> requestedParams , $ defaultParams , $ this -> getQueryStringParamsSepatator ( ) , TRUE ) ; if ( mb_strpos ( $ selfUrlDomainAndBasePart , '//' ) === FALSE ) $ selfUrlDomainAndBasePart = $ request -> GetDomainUrl ( ) . $ selfUrlDomainAndBasePart ; if ( mb_strlen ( $ selfUrlDomainAndBasePart ) > 0 && $ selfUrlDomainAndBasePart !== $ request -> GetBaseUrl ( ) ) { $ redirectToCanonicalUrl = TRUE ; } else if ( mb_strlen ( $ selfUrlPathAndQueryPart ) > 0 ) { $ path = $ request -> GetPath ( FALSE ) ; $ requestedUrl = $ path === '' ? '/' : $ path ; if ( mb_strpos ( $ selfUrlPathAndQueryPart , '?' ) !== FALSE ) { $ selfUrlPathAndQueryPart = rawurldecode ( $ selfUrlPathAndQueryPart ) ; $ requestedUrl .= $ request -> GetQuery ( TRUE , FALSE ) ; } if ( $ selfUrlPathAndQueryPart !== $ requestedUrl ) $ redirectToCanonicalUrl = TRUE ; } if ( $ redirectToCanonicalUrl ) { $ selfCanonicalUrl = $ this -> Url ( $ this -> selfRouteName , $ this -> requestedParams ) ; $ this -> redirect ( $ selfCanonicalUrl , \ MvcCore \ IResponse :: MOVED_PERMANENTLY ) ; return FALSE ; } return TRUE ; }
If request is routed by rewrite routes strategy, try to complete canonical
URL by current route. Then compare completed base URL part with requested
base URL part or completed path and query part with requested path and query
part. If first or second part is different, redirect to canonical shorter URL.
@return bool
If request is routed by rewrite routes strategy try to complete canonical URL by current route . Then compare completed base URL part with requested base URL part or completed path and query part with requested path and query part . If first or second part is different redirect to canonical shorter URL .