Skip to content

paths with/and querystring #19

Description

@Naberd

had issue with adding path's like lvn/3_0_content.asp?action=archive
here we have path and query
or ?id=2345
here we have only querystring
which means those pages are never will be redirected

so have adjusted code :

        if ($path !== '') {
            $redirect = $this->redirectRepository->findByPathAndDomain($host, $path);

            if ($redirect) {
                HttpUtility::redirect($redirect->getUrl($scheme, $host, $path), $redirect->getHttpStatus());
            } else {
            	$redirect = $this->redirectRepository->findByPathAndDomain($host, $path.'?'.$request['query']);
            	if ($redirect) {
                	HttpUtility::redirect($redirect->getUrl($scheme, $host, $path), $redirect->getHttpStatus());
                }
            }
        } elseif(strpos($request['query'], 'id') !== false){
            $path='?'.$request['query'];
            $redirect = $this->redirectRepository->findByPathAndDomain($host, $path);
            if($redirect){
                HttpUtility::redirect($redirect->getUrl($scheme, $host, $path), $redirect->getHttpStatus());
            }
        }

also not sure why but after change $this->redirect function stopped working so replaced it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions