The Request URI Problem

Photo
jacmgr
2013 November 10

UPDATE: The phile core no longer has this problem! Core now handles the querystring and uri properly and strips the query string from the uri. NO CHANGES NEEDED. IGNORE THIS POST!!

If your url has any request ($_GET) variables, the URI does not seem to be parsed correctly and you get a 404.

I modified the core to strip the querystring from the uri.

File: Lib\Phile\Core.php


protected function initCurrentPage() { $uri = $_SERVER['REQUEST_URI']; $uri = str_replace('/' . \Phile\Utility::getInstallPath() . '/', '', $uri); // Strip query string // jacmgr $data['uri'] is not changeable in plugin, so modify here...... $uri = preg_replace('/\?.*/', '', $uri); // Strip query string /** * @triggerEvent request_uri this event is triggered after the request uri is detected. * @param uri the uri */ Event::triggerEvent('request_uri', array('uri' => $uri)); // use the current url to find the page // jacmgr: Shoudl use the modified without query string //$page = $this->pageRepository->findByPath($_SERVER['REQUEST_URI']); $page = $this->pageRepository->findByPath($uri);