
Otherwise, a 404 error will be returned using either your custom error template or Craft’s own default. If Dev Mode is enabled, an error report for the exception will be shown. If none of the above checks are successful, Craft will throw a NotFoundHttpException (opens new window). blog/_archive/index), Craft will skip this step. If any of the URI segments begin with an underscore (e.g.

For example, if an entry’s URI is requested, then the entry will route the request to the template specified in its section’s settings, with an entry variable predefined, set to the requested entry. If the URI matches an element’s URI, Craft lets the element decide how to route the request. The controller may allow it to keep going. The request doesn’t necessarily end after a controller call. Craft has system Controller actions for core actions, but plugins may also have Controllers that define their own custom actions.

But if you point your browser directly at a file that does exist (such as an image, CSS, or JavaScript file), your web server will serve that file directly without loading Craft.Īction requests either have a URL that begins with actions/ (or whatever your actionTrigger config setting is set to), or an action parameter in the POST request or the query string.Ĭraft routes action requests to a controller action that perform actions. htaccess file that comes with Craft (opens new window) will redirect all requests that don’t match a directory or file on your web server over to index.php behind the scenes. It’s important to keep in mind that Craft doesn’t get involved for every request that touches your server, but only requests that go to your index.php file. Should Craft handle this request in the first place?

This information can helpful to you when troubleshooting template loading, plugin action URLs, dynamic routes, and unexpected 404 errors. The checks detailed below explain how this process works.

When a request comes in to Craft, it checks to determine where to route the request. Routing helps Craft smartly handle requests to your site.
