A small foundation for your next website
Clean URLs for
simple PHP sites.
Write your pages in PHP and HTML. Cornerstone gives them clean URLs automatically.
For when you know PHP and just want to make a website.
Add a file. It has a URL.
Put a PHP file in pages/ and Cornerstone makes it a page. Folders become part of the address. There’s no route list to maintain.
The .php stays in the filename, out of the URL.
- pages/index.php
- /
- pages/docs/index.php
- /docs
- pages/docs/urls.php
- /docs/urls
These are real pages on this site. Follow a URL to see one.
A whole page, from file to browser.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHP Cornerstone - Hello, world</title>
</head>
<body>
<h1>Hello, world.</h1>
<p>This is a whole page. Make a file, and it has a URL.</p>
</body>
</html>
That’s the complete file. Open the page to see what it produces—nothing to download first.
Your pages, your PHP
Use what you already know.
Write HTML, add PHP where you need it, and use includes for shared headers and footers. There’s no template language to learn.
Organize your code however it makes sense to you. Bring in a library or connect to a database when you need one.
See shared layouts and a little PHPThe useful basics
Small site. Proper URL handling.
One clean address. A page’s .php and trailing-slash addresses redirect to its clean URL.
Keep old links working. When a page moves, add its old and new addresses to the redirect file.
A helpful 404. Show your own page when an address doesn’t exist, with the correct 404 status.
Exactly how the URLs workReady to make something?
This site is your starting point.
The download includes this website, the routing code, and every example you’ve seen. Change a page, keep what you need, and make it yours.
Get the starterPHP 8.3 or newer. No database needed. No frontend build step required.