Make WordPress Core

Opened 11 years ago

Last modified 6 years ago

#26885 new defect (bug)

Path Based Multisite Rewrite rule absolute path without trailing slash

Reported by: skalex's profile skalex Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Rewrite Rules Keywords: needs-patch
Focuses: multisite Cc:

Description

The .htaccess rewrite rules generator output the absolute path to the files, but there is missing a slash at the begining to use it as absolute.
I've seen the same problem at http://wordpress.stackexchange.com/questions/77818/multisite-configuration-fails-with-css-js-files
The solution is to make it relative, or to add a "/" at the beggining of the two rewrite rules.
I think the .htaccess code generated can be fixed for future users.

Change History (4)

#1 @jeremyfelt
11 years ago

  • Keywords reporter-feedback added

Hi @skalex, thanks for the report.

Can you provide more detail on the issue that you're seeing? It would be helpful to know what URL is being attempted for the CSS and JS files that is not working.

#2 @skalex
11 years ago

The links attemped for the CSS and JS are fine and now working correctly. i.e. http://www.example.com/test/wp-includes/css/dashicons.min.css?ver=3.8
The problem is the .htaccess rewrite rules, they failed, so the Apache could not find the files. I have fixed it modifing them in the .htaccess, but the bug I am reporting is that the generated code must be okay, it must not require aditional modifications. The .htacceess generated code was

RewriteEngine On
RewriteBase /pages/
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).*) var/www/site/$2 [L]
RewriteRule ([_0-9a-zA-Z-]+/)?(.*\.php)$ var/www/site/$2 [L]
RewriteRule . index.php [L]

As you can see, the path is incorrect, because is missing a trailing slash. It must be changed to from "var/www/site/$2" to "/var/www/site/$2" to make it absolute. Other way, I also fixed it setting to "$2", a relative path.
I have looked at the network.php, I think the problem is on the $rewrite_base variable. I don't understand why the trailing slash are removed

$rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ;

Now, I have changed the site URL, so the $rewrite_base is setted to "" (wich is correct to make a relative path). I can't reproduce now the bug, cause I continue with my site construction. If I can reproduce it I will add the details.

#3 @jeremyfelt
11 years ago

  • Component changed from Multisite to Rewrite Rules
  • Focuses multisite added

#4 @chriscct7
9 years ago

  • Keywords reporter-feedback removed
  • Severity changed from minor to normal
Note: See TracTickets for help on using tickets.