Skip to main content
VoxelSite ships with an .htaccess file that handles clean URL routing and security rules on Apache. Nginx ignores .htaccess entirely — you need to add equivalent rules to your Nginx site configuration. Without this configuration, visiting /about will show your homepage instead of about.php, because Nginx doesn’t know to try the .php extension.

The essential fix: clean URLs

VoxelSite generates pages as PHP files (about.php, contact.php, etc.) and links to them with clean URLs (/about, /contact). On Apache, the .htaccess rewrite rule handles this automatically. On Nginx, you need to add a named location that rewrites extensionless URLs to .php. Find the location / block in your Nginx config and replace it with:
Why not $uri.php in try_files? Adding $uri.php as a middle argument in try_files finds the file but serves it as raw text — it bypasses the PHP handler. The named @cleanurls location with rewrite ... last does a proper internal redirect that re-evaluates against location ~ \.php$, ensuring PHP-FPM processes the file.

Agent API routing

The Agent API works without this rule. The Studio router automatically detects /agent/v1/ requests and forwards them to the Agent API router. The Nginx rewrite below is a performance optimization — it routes requests directly to the Agent API router, skipping the Studio router overhead. For most installations, the automatic fallback is sufficient.
If you want direct routing (recommended for production), add this before the location / block:
This mirrors the Apache .htaccess rule, which passes the path as ?_path=$1. For example, a request to /_studio/api/agent/v1/pages will be rewritten to /_studio/api/agent/v1/router.php?_path=pages. The .htaccess also blocks access to sensitive directories and files. Add these before the location / block:

Complete Nginx config example (Forge)

Here’s a complete site configuration block for Laravel Forge. Replace the site ID (3050636) with your own:
The fastcgi_param HTTP_AUTHORIZATION $http_authorization; line is essential if you use the Agent API. Without it, Nginx strips the Authorization header before it reaches PHP, causing all authenticated API calls to fail with 401.

Where to edit this on Forge

1

Open the Nginx configuration editor

Go to Sites → your site → Nginx Configuration (the Edit button on the files panel).
2

Locate the server block

Find the server { ... } block in your config.
3

Apply the changes

Replace the location / block and add the security rules as shown above.
4

Save

Click Save — Forge automatically reloads Nginx.