Search by

n5s / wp-symfony-local-server

n5s

Fixes WordPress compatibility issues when running on Symfony Local Server with local domain names

Package info

github.com/nlemoine/wp-symfony-local-server

pkg:composer/n5s/wp-symfony-local-server

Fund package maintenance!

nlemoine

Statistics

Installs: 2 103

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v2.1.0 2026-12-02 21:30 UTC

This package is auto-updated.

Last update: 2026-12-02 21:30:33 UTC


README

Latest Version Software License Build Status Code Coverage Total Downloads

Fixes WordPress compatibility issues when running on Symfony Local Server with local domains (.wip).

Installation

composer require n5s/wp-symfony-local-server --dev

That's it. The library auto-detects Symfony Local Server and registers the necessary hooks.

What it fixes

Problem Solution
Self-requests fail (SSL errors, unresolved .wip TLD) Routes them through Symfony's proxy with proper certificates
/wp-admin/ causes redirect loops Rewrites to /wp-admin/index.php (why?)
Redirect caching issues Uses HTTP 302 instead of 301 for admin redirects
Subdirectory multisite: sub-site admin, login and core assets are broken Opt-in router applying the WordPress rewrite rules (setup)

Subdirectory multisite

A subdirectory multisite needs rewrite rules: /en/wp-admin/edit.php must run wp-admin/edit.php, and /en/wp-includes/… must serve the core files. Symfony Local Server has no rewrite rules. It serves existing files and sends everything else to index.php, so the sub-site admin, login and core assets don't work.

The package ships a router.php that applies the same rules before WordPress loads. Make it the front controller in .symfony.local.yaml (or in a git-ignored .symfony.local.override.yaml), with a path relative to the document root, then restart the server:

http:
    passthru: ../vendor/n5s/wp-symfony-local-server/router.php

The router only handles requests that don't match an existing file, and hands every other request to index.php. WordPress can be at the document root or in its own directory (WP Starter, Bedrock): the router finds it.

If you can't change the server configuration, require it at the top of the document root index.php instead (adjust the path to where vendor/ is):

if (is_file(__DIR__ . '/../vendor/n5s/wp-symfony-local-server/router.php')) {
    require __DIR__ . '/../vendor/n5s/wp-symfony-local-server/router.php';
}

The router does nothing outside Symfony Local Server. It also makes /wp-admin/ work on single sites.

How it works

The library only activates when it detects Symfony Local Server (via SERVER_SOFTWARE header or ~/.symfony5/proxy.json config). It then:

  1. Sets WP_PROXY_HOST and WP_PROXY_PORT to route internal requests through Symfony's proxy
  2. Provides Symfony's root CA certificate for SSL verification
  3. Hooks into admin_url and redirect_canonical to fix admin URL handling

Requirements

  • PHP 8.2+
  • Symfony CLI with local proxy configured