wp-cli/server-command

PHP built-in webserver doesn't handle rewrite conditions defined in .htaccess

Closed this issue · 3 comments

Hello
i Have an issue using wp server for hosting in development a multi-network of multi-site.
here is my conf

$ wp core version --extra
WordPress version: 4.8.1
Database revision: 38590
TinyMCE version:   4.603 (4603-20170530)
Package language:  fr_FR
$ wp site list --fields=blog_id,url,site_id
+---------+------------------------------------------------+---------+
| blog_id | url                                            | site_id |
+---------+------------------------------------------------+---------+
| 1       | http://dev.example.fr:8090/            | 1       |
| 2       | http://dev.example.fr:8090/test/       | 1       |
| 3       | http://dev.other-example.fr:8090/      | 2       |
| 4       | http://dev.other-example.fr:8090/test/ | 2       |
+---------+------------------------------------------------+---------+ 
$ wp plugin list
+-----------------------------------+----------------+--------+---------+
| name                              | status         | update | version |
+-----------------------------------+----------------+--------+---------+
| advanced-access-manager           | active-network | none   | 5.0     |
| contact-form-7                    | inactive       | none   | 4.9.1   |
| diamond-multisite-widgets         | active-network | none   | 1.8.2   |
| google-analytics-dashboard-for-wp | active-network | none   | 5.1.2.2 |
| wp-multisite-feed                 | active-network | none   | 1.0.3   |
| mailchimp-for-wp                  | inactive       | none   | 4.1.11  |
| movabletype-importer              | active-network | none   | 0.4     |
| multisite-enhancements            | active-network | none   | 1.4.1   |
| multisite-list-widget             | inactive       | none   | 0.1     |
| network-latest-posts              | inactive       | none   | 3.7.1   |
| require-featured-image            | inactive       | none   | 1.3.0   |
| w3-total-cache                    | active-network | none   | 0.9.5.4 |
| wp-multi-network                  | active-network | none   | 1.8.1   |
| wordpress-seo                     | active-network | none   | 5.8     |
| common                            | must-use       | none   | 1.0.0   |
| sharer                            | must-use       | none   | 1.0.0   |
| advanced-cache.php                | dropin         | none   |         |
| db.php                            | dropin         | none   |         |
+-----------------------------------+----------------+--------+---------+

My problem are on blog 2 & 4 :

  • I can't access wp-admin for blog 2 & 4
  • All Static (CSS/JS/IMG) files from blog 2&4 are in 404

when i use an Basic nginx server or Apache Server, all is working well.

Please help

Hi @lmacret,

GitHub issues are meant for enhancement requests and specific, reproducible bugs, not for general support questions. For support options, please review http://wp-cli.org/#support

In discussing this in Slack, we've identified the source of the problem. PHP's built-in webserver doesn't support .htaccess, which is required for some of those rewrite conditions to be applied.

I'm not sure whether it's viable for WP-CLI to automatically handle .htaccess files. If it isn't, then we should make sure this behavior is documented.

the rules are the one shown in admin page for network creation : /wp-admin/network/setup.php

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]