PHPackages                             wyrihaximus/react-http-middleware-rewrite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. wyrihaximus/react-http-middleware-rewrite

ActiveLibrary[HTTP &amp; Networking](/categories/http)

wyrihaximus/react-http-middleware-rewrite
=========================================

A internal path rewrite middleware for react/http

2.0.0(5y ago)12.2k1[4 PRs](https://github.com/WyriHaximus/reactphp-http-middleware-rewrite/pulls)MITMakefilePHP ^7.4

Since Nov 17Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/WyriHaximus/reactphp-http-middleware-rewrite)[ Packagist](https://packagist.org/packages/wyrihaximus/react-http-middleware-rewrite)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-react-http-middleware-rewrite/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (8)Used By (0)

A internal path rewrite middleware for react/http
=================================================

[](#a-internal-path-rewrite-middleware-for-reacthttp)

[![Build Status](https://camo.githubusercontent.com/898ac1d752c802714f5b39e3c4ea5343b0bd4589bc767aa888ebcb5e054b75e0/68747470733a2f2f7472617669732d63692e636f6d2f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726577726974652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/WyriHaximus/reactphp-http-middleware-rewrite)[![Latest Stable Version](https://camo.githubusercontent.com/6bc90834a30f3759105f9ce48e2f0f8d13a1ef920f7fdcdc88509058821554f2/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726577726974652f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-rewrite)[![Total Downloads](https://camo.githubusercontent.com/f115416ce4469d8d855102c7796defdb919b74cb7ba465a0c6b1e9fd7bb89c93/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726577726974652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-rewrite)[![Code Coverage](https://camo.githubusercontent.com/1346a2c8821a2e90c1ebdac15166fb06e18b356c3efc683e55b2be02330584e8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726577726974652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-rewrite/?branch=master)[![License](https://camo.githubusercontent.com/fff2f23bad2e947735e7c052230b5e83c5fd33b8ae0a96cab8b541bd86eee0c0/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726577726974652f6c6963656e73652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-rewrite)[![PHP 7 ready](https://camo.githubusercontent.com/6067397887f652e005590169350ca9c75f4e9675a8a4762a9547dfd4eb56317d/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726577726974652f62616467652e737667)](https://travis-ci.com/WyriHaximus/reactphp-http-middleware-rewrite)

Install
=======

[](#install)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.

```
composer require wyrihaximus/react-http-middleware-rewrite

```

Usage
=====

[](#usage)

While [`wyrihaximus/react-http-middleware-webroot-preload`](https://github.com/WyriHaximus/reactphp-http-middleware-webroot-preload)is great for serving static files. It doesn't (and won't) support serving `/index.html` as `/`. Enter the rewrite middleware, underwater it will change the path from `/` to `/index.html` so that the webroot preload middleware can serve `/index.html` as `/`.

```
$server = new Server([
    /** Other middleware */
    new RewriteMiddleware(
        new Rewrite('/', '/index.html'),
    ),
    new WebrootPreloadMiddleware(/** args */),
    /** Other middleware */
]);
```

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2018 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance43

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~601 days

Total

2

Last Release

2128d ago

Major Versions

1.0.0 → 2.0.02020-07-11

PHP version history (2 changes)1.0.0PHP ^7.2

2.0.0PHP ^7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (54 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (44 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (19 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (15 commits)")

---

Tags

hacktoberfest

### Embed Badge

![Health badge](/badges/wyrihaximus-react-http-middleware-rewrite/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-react-http-middleware-rewrite/health.svg)](https://phpackages.com/packages/wyrihaximus-react-http-middleware-rewrite)
```

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[http-interop/response-sender

A function to convert PSR-7 Response to HTTP output

46711.5k40](/packages/http-interop-response-sender)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
