src/Http/Kernel.php
/**
	 * Tries to redirect from a file to a directory. For example, if the current request is to /about and no route is
	 * found at that location, it will try /about/. This emulates web servers like Apache and nginx. Returns true if
	 * a redirection has taken place.
	 *
	 * @return bool
	 */
Tries to redirect from a file to a directory. For example, if the current request is to /about and no route is
found at that location, it will try /about/. This emulates web servers like Apache and nginx. Returns true if
a redirection has taken place.

@return bool
Tries to redirect from a file to a directory . For example if the current request is to / about and no route is found at that location it will try / about / . This emulates web servers like Apache and nginx . Returns true if a redirection has taken place . @return bool
private function tryDirectoryRedirect() {
		if (config('app.redirect_to_directories', true) === false) {
			return false;
		}
		if (substr($this->request->path(), -1) !== "/") {
			$originalUri = $this->request->path();
			$originalRequest = $this->request;
			$_SERVER['REQUEST_URI'] = $originalUri . '/';
			if ($this->request->getQueryString()) {
				$_SERVER['REQUEST_URI'] .= '?' . $this->request->getQueryString();
			}
			$this->realPath = $this->request->path();
			$this->createRequest();
			$route = RouteLoader::getRouter()->match($this->request);
			if (!is_null($route)) {
				$this->response->redirect($this->request->fullUrl(), 302);
				$this->close();
				return true;
			}
			$this->realPath = $_SERVER['REQUEST_URI'] = $originalUri;
			$this->request = $originalRequest;
		}
		return false;
	}
private function tryDirectoryRedirect ( ) { if ( config ( 'app.redirect_to_directories' , true ) === false ) { return false ; } if ( substr ( $ this -> request -> path ( ) , - 1 ) !== " / " ) { $ originalUri = $ this -> request -> path ( ) ; $ originalRequest = $ this -> request ; $ _SERVER [ 'REQUEST_URI' ] = $ originalUri . '/' ; if ( $ this -> request -> getQueryString ( ) ) { $ _SERVER [ 'REQUEST_URI' ] .= '?' . $ this -> request -> getQueryString ( ) ; } $ this -> realPath = $ this -> request -> path ( ) ; $ this -> createRequest ( ) ; $ route = RouteLoader :: getRouter ( ) -> match ( $ this -> request ) ; if ( ! is_null ( $ route ) ) { $ this -> response -> redirect ( $ this -> request -> fullUrl ( ) , 302 ) ; $ this -> close ( ) ; return true ; } $ this -> realPath = $ _SERVER [ 'REQUEST_URI' ] = $ originalUri ; $ this -> request = $ originalRequest ; } return false ; }
Tries to redirect from a file to a directory.
Tries to redirect from a file to a directory .
// Add a trailing slash to the request uri // Add query string // Store the path for errors // Create a new request object // See if the directory route matches // Redirect to the new uri // Revert the request uri