Try the beta version of the new SilverStripe documentation

For the next 2 weeks you can use the new documentation website and give us your feedback.


This document contains information about a future release and not the current stable version (3.1).

Be aware that information on this page may change and API's may not be stable for production use.

Execution Pipeline


This page documents all the steps from an URL request to the delivered page.

.htaccess and RewriteRule

Silverstripe uses mod_rewrite to deal with page requests. So instead of having your normal everyday index.php file which tells all, you need to look elsewhere.

The basic .htaccess file after installing SilverStripe look like this:

<Files *.ss>
Order deny,allow
Deny from all
Allow from
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]

The <Files> section denies direct access to the template files from anywhere but the server itself.

The <IfModule> section enables the rewriting engine. Requests will be rewritten if they meet the following criteria:

  • URI doesn't end in .gif, .jpg, .png, .css, or .js
  • The requested file doesn't exist on the filesystem The rewriting engine then calls framework/main.php with the REQUEST_FILENAME (%1) as the url parameter and also appends the original QUERY_STRING. Example: "myblog/cakes?page=2" is rewritten as "framework/main.php?url=myblog/cakes&page=2".

See the mod_rewrite documentation for more information on how mod_rewrite works.


All requests go through main.php, which sets up the environment and then hands control over to Director.

Director and URL patterns

main.php relies on Director to work out which controller should handle this request. Director will instantiate that controller object and then call Controller::run()&version=trunk&module=framework).

In general, the URL is build up as follows: page/action/ID/otherID - e.g. http://localhost/mypage/addToCart/12. This will add an object with ID 12 to the cart.

When you create a function, you can access the ID like this:

public function addToCart ($request) {
    $param = $request->allParams();
    echo "my ID = " . $param["ID"];
    $obj = MyProduct::get()->byID($param["ID"]);

Controllers and actions

Controllers are the building blocks of your application.

See: The API documentation for Controller

You can access the following controller-method with /team/signup

class Team extends DataObject {}
class Team_Controller extends Controller {
    private static $allowed_actions = array('signup');
    public function signup($id, $otherId) {
        return $this->renderWith('MyTemplate');

SSViewer template rendering

See templates for information on the SSViewer template system.


Comment policy: Please use comments for tips and corrections about the described functionality.
Comments are moderated, we reserve the right to remove comments that are inappropriate or are no longer relevant. Use the Silverstripe Forum to ask questions.

blog comments powered by Disqus