Documentation

Clean URLs. Clear rules.

The file structure is the route map. There’s no second list to keep up to date.

FileURL
pages/index.php/
pages/about.php/about
pages/docs/index.php/docs
pages/docs/urls.php/docs/urls

One preferred path.

Page URLs have no trailing slash, except the homepage. For an existing page, /about/ and /about.php redirect to /about. A folder’s /docs/index.php and /docs/index redirect to /docs.

These automatic redirects use 308, preserving the request method and query string. Explicit redirects run first. Missing paths return 404 without a speculative redirect.

Queries don’t choose the page.

/examples/greeting?name=Sam loads the same page as /examples/greeting. PHP makes the value available in $_GET['name'].

Names are literal and case-sensitive.

Prefer lowercase words and hyphens. Unicode filenames work with UTF-8 URLs. Spaces, control characters, percent signs, backslashes, and hidden path segments are not supported. Malformed encoding, encoded slashes, and ambiguous paths are rejected with 400.

Two files cannot claim the same URL. Don’t create both pages/about.php and pages/about/index.php. Cornerstone reports the conflict in the server log and returns a 500 rather than silently picking one.

A page that isn’t there.

Edit errors/404.php to change the missing-page screen. It receives the same $site helper as other pages and returns a real HTTP 404. Preview the missing-page screen.

Links that work in a subdirectory.

At a domain root, href="/about" is fine. If the site lives under /my-site, set base_path in config.php and use the helper available in every page:

<a href="<?= Cornerstone\escape($site->url('/about')) ?>">About</a>

The helper adds the configured prefix. It doesn’t infer a host from request headers. Configure HTTPS and your preferred hostname on your web server; see hosting.