Getting Started
Installation
Get Bolt CMS running on any PHP server in under five minutes. No database, no package manager, no build tools.
Prerequisites
Bolt CMS has minimal requirements:
- PHP 7.4+ (any hosting with PHP works)
- Apache with
mod_rewriteenabled - No database needed
- No Composer or Node.js
If you have MAMP, XAMPP, Laravel Valet, or any standard PHP hosting environment, you are ready to go.
Directory Structure
Create a new directory for your Bolt site and add the following folder structure:
bolt/
├── .htaccess
├── index.php
├── pages/
│ └── index.php
├── headers/
│ └── default.php
├── footers/
│ └── default.php
├── layouts/
│ └── default.php
├── includes/
└── api/
Each directory has a clear purpose:
| Directory | Purpose |
|---|---|
pages/ |
Content files. Each file or directory becomes a URL route. |
headers/ |
Header partials (navigation, branding). |
footers/ |
Footer partials (links, copyright). |
layouts/ |
Layout templates that wrap page content. |
includes/ |
Shared PHP utilities and helpers. |
api/ |
Server-side API endpoints (search, chat, etc.). |
Configure .htaccess
Create a .htaccess file in your site root. This sends all requests to index.php for routing:
RewriteEngine On
# If the request is for an existing file or directory, serve it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise, route everything through index.php
RewriteRule ^(.*)$ index.php [QSA,L]
This is the only server configuration needed. All routing logic lives in PHP.
Configure index.php
The entry point file defines constants, resolves the requested page, and renders the HTML shell:
<?php
define('ROOT_DIR', __DIR__);
// Build the site URL dynamically
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$scriptName = $_SERVER['SCRIPT_NAME'] ?? '';
$basePath = rtrim(str_replace('/index.php', '', $scriptName), '/');
define('SITEURL', $protocol . $host . $basePath);
define('BASE_PATH', $basePath);
// Parse the request URI
$request_URI = $_SERVER['REQUEST_URI'] ?? '/';
if ($basePath !== '' && strpos($request_URI, $basePath) === 0) {
$request_URI = substr($request_URI, strlen($basePath));
}
if (empty($request_URI)) $request_URI = '/';
// Default page configuration
$page = [
'config' => [
'title' => 'My Bolt Site',
'description' => '',
'keywords' => '',
'header' => 'default',
'layout' => 'default',
'footer' => 'default',
'pageTitle' => '',
'pageDescription' => '',
],
'content' => ''
];
// Route the request to a page file
if ($request_URI !== '/') {
$path = explode('?', $request_URI)[0];
$path = explode('#', $path)[0];
$path = rtrim(ltrim($path, '/'), '/');
$path = preg_replace('/[^a-zA-Z0-9\-\/]/', '', $path);
if (file_exists(__DIR__ . '/pages/' . $path . '.php')) {
require(__DIR__ . '/pages/' . $path . '.php');
} elseif (file_exists(__DIR__ . '/pages/' . $path . '/index.php')) {
require(__DIR__ . '/pages/' . $path . '/index.php');
} else {
header('HTTP/1.0 404 Not Found');
exit;
}
} else {
require(__DIR__ . '/pages/index.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $page['config']['title']; ?></title>
<script src="includes/paradigm.css.js"></script>
</head>
<body>
<?php
require_once(__DIR__ . '/headers/' . $page['config']['header'] . '.php');
require_once(__DIR__ . '/layouts/' . $page['config']['layout'] . '.php');
require_once(__DIR__ . '/footers/' . $page['config']['footer'] . '.php');
?>
</body>
</html>
Create Your First Page
Create pages/index.php — this is your home page:
<?php
$page['config']['title'] = 'Welcome to My Site';
$page['config']['pageTitle'] = 'Hello, World';
$page['config']['pageDescription'] = 'This is my first Bolt CMS page.';
ob_start();
?>
<h2>It works!</h2>
<p>If you can see this, Bolt CMS is running correctly.</p>
<?php
$page['content'] = ob_get_clean();
?>
Key points about the page pattern:
- Set
$page['config']values before the output buffer starts. - Use
ob_start()to begin capturing HTML content. - Write your page content as plain HTML between the buffer calls.
- Assign the buffer to
$page['content']withob_get_clean().
Create a Default Layout
Create layouts/default.php. At minimum it just echoes the page content:
<?php echo $page['content']; ?>
Create empty headers/default.php and footers/default.php files as well. You can add navigation and footer content to these later.
Verify It Works
Start your PHP server and visit the site root:
# If using PHP's built-in server:
php -S localhost:8000
# Or visit your MAMP/XAMPP URL:
# http://localhost/bolt/
You should see your "Hello, World" page rendered with the title set in the browser tab. If you see a 404 or blank page:
- Verify
mod_rewriteis enabled (a2enmod rewriteon Linux). - Check that
AllowOverride Allis set in your Apache config for the directory. - Confirm the
.htaccessfile is in the same directory asindex.php.
Next Steps
With the base installed, you can now:
- Add more pages by creating files in
pages/(see Routing). - Build custom layouts with sidebars, navs, and footers (see Layouts & Templates).
- Style your site with Paradigm CSS (see Design System).