Closed scribu closed 11 years ago
That'd work for all intents and purposes.
Haven't thought through what I'm about to say next: Could class out the router to use traits, or to be extendable.
There isn't that much code in router.php
right now to go full OOP on it. All the general-purpose utilities are already moved to router-lib.php
.
Wait, if you need these rewrites for Roots to function properly, does that mean that everyone that uses Roots has to edit their .htaccess
file and/or nginx configs?
only nginx, the .htaccess
is handled by lib/rewrites.php
I see. But if the router loads index.php
(which then loads WordPress), wouldn't it be possible to write a standard WordPress plugin that handles those rewrites?
You could check PHP_SAPI == 'cli-server'
to make sure it kicks in only when wp server
is used.
Good ideas; seems to work: https://github.com/leoj3n/wp-server-roots-rewrites
Sweet!
The first fork of the server-command repo has popped up (yay!):
https://github.com/leoj3n/server-command/compare/roots-rewrites
It would be neat if there was a way to support custom rewrite rules in a generic way. One potential idea:
The
wp server
command could pass the path via an environment variable to the router, which would then load it where theroots_rewrites()
function is called now.