[wp-trac] [WordPress Trac] #49069: Multisite: 404 template isn't used in network installs when a file extension is used in the URL

WordPress Trac noreply at wordpress.org
Mon Dec 23 16:19:04 UTC 2019


#49069: Multisite: 404 template isn't used in network installs when a file
extension is used in the URL
--------------------------+------------------------------
 Reporter:  henry.wright  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  multisite
--------------------------+------------------------------
Changes (by pbiron):

 * focuses:   => multisite


Comment:

 This only happens when the file extension is `.php` and is because of the
 .htaccess rewrite rules that are used with multisite.

 == multisite sub-directory rewrite rules
 {{{
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]

 # add a trailing slash to /wp-admin
 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]
 # the following rule is the "culprit" and is necessary for URLs like:
 # https://example.com/sub-site/wp-login.php
 RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ \$2 [L]
 RewriteRule . index.php [L]
 }}}

 This only happens when the file extension is `.php` and is because of the
 .htaccess rewrite rules that are used with multisite.

 == multisite sub-domain rewrite rules
 {{{
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]

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

 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^ - [L]
 RewriteRule ^(wp-(content|admin|includes).*) \$1 [L]
 # the following rule is the "culprit" and is necessary for URLs like:
 # https://sub-site.example.com/wp-login.php
 RewriteRule ^(.*\.php)$ \$1 [L]
 RewriteRule . index.php [L]
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49069#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list