mrjasongorman Posted October 27, 2015 Share Posted October 27, 2015 I'm intrigued about how Processwire resolves URLS. I've been having a snoop around the database and found that each page has a "name" which looks to be it's section of a URL. The thing that's puzzling me is say a page is at this address example.com/mens/tshirts/product-name/ how does processwire process that URL? i understand it's easy enough to process just example.com/product-name/ that's just a simple database lookup, but how does it go about validating the position of that page in the database hierarchy with the hierarchy of the URL? I know that the web server is rewriting urls to /index.php?it=$uri&$args I noticed that Wordpress and other systems must use a similar technique. But how does Processwire manage to do this at such speed? Any help on how this works would be great Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 27, 2015 Share Posted October 27, 2015 There's the page_parents table in the db, which holds all the hierarchy related information. And the actual db query is just more or less a simple $pages->get("path=/mens/tshirts/…/");, which you can find in ProcessPageView::getPage(). If the first try won't find anything it just checks each hierarchy above if pages are found and if so, the other parts of the url are further evalulated as urlSegements. The actual domain is only checked against the $config->httpHosts whitelist and not really involved in the page finding process. 2 Link to comment Share on other sites More sharing options...
mrjasongorman Posted October 27, 2015 Author Share Posted October 27, 2015 Ah i see, so it just passes it in as an PW API query. I'm guessing the relevant functions are in the /wire folder? Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 27, 2015 Share Posted October 27, 2015 Yep. Everything startup related is basically in this order: index.php -> /wire/core/ProcessWire.php ^ index.php -> /wire/modules/Process/ProcessPageView.module 2 Link to comment Share on other sites More sharing options...
mrjasongorman Posted October 27, 2015 Author Share Posted October 27, 2015 Cool, thanks for helping out! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now