Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12758 closed defect (bug) (fixed)

Better server checks in network.php

Reported by: nacin Owned by:
Milestone: 3.0 Priority: high
Severity: normal Version:
Component: Multisite Keywords: has-patch needs-testing
Focuses: Cc:


network.php makes careful double-checks (literally) for mod_rewrite in step 1, but nothing in step 2 when it actually presents the rules.

We should be able to detect mod_rewrite in step 2. If they're not running Apache at all, they probably don't need the Apache rules.

Additionally, we need IIS detection and support in both steps.

Attachments (3)

new_iis_rewrite_rules.diff (17.1 KB) - added by Frumph 8 years ago.
Rewrite Rules changes and check for IIS / apache for the network page.
newer_iis_rewrite_rules_404_noblogredirect_fix.diff (17.7 KB) - added by Frumph 8 years ago.
Okay this is all working, subdirectory, subdomain and shows the info in the network panel.
remove-indents.12758.diff (12.1 KB) - added by filosofo 8 years ago.

Download all attachments as: .zip

Change History (30)

#1 @westi
8 years ago

  • Keywords needs-patch added

8 years ago

Rewrite Rules changes and check for IIS / apache for the network page.

#2 @Frumph
8 years ago

  • Keywords has-patch needs testing added; needs-patch removed

There's just one problem with the .diff is the content portion which i've commented on, otherwise it's working on my end where the network page displays the appropriate rules for.

Another thing it would be nice if I could call the function iis7_url_rewrite_rules from inside of the network.php file, unfortunately I do not know how to call functions inside of a class.

#3 @Frumph
8 years ago

  • Keywords needs-testing added; needs testing removed

#4 @Frumph
8 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

Found some bugs in the url rewrite diff, fixing them now.

#5 @westi
8 years ago

  • Cc ruslany westi added

Please don't do this:


It makes it really hard to read.

Much better to just use a multi-line string.

If this doesn't get a patch in the next couple of days it will likely miss 3.0

#6 @filosofo
8 years ago

Does IIS require indentation for code logic, like Python or something?

#7 @ruslany
8 years ago

No, identation does not affect the IIS runtime. The reason identation is added is so that the rules preview in the Options -> Permalinks page and in the generated configuration file look nice with proper XML indentation.

#8 @Frumph
8 years ago

Well the problem with what I wrote above in that .diff is that the "mainsite" url doesnt transfer 404's, the subsites, mulsitesites off of the main site work just fine.

#9 @wpmuguru
8 years ago

Do we have a patch that works & can be applied?

#10 @Frumph
8 years ago

Alright I figured it out, it's in the wordpress code someplace that the problem is, why? cause this is why.

{{{define('VHOST', 'yes');
If VHOST is 'yes' uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled)
For example, the browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' );
Set this value to %siteurl% to redirect to the root of the site
define( 'NOBLOGREDIRECT', 'http://frumph.net' );
On a directory based install you must use the theme 404 handler.
If I uncomment the
define( no blog redirect, which it was it will have the problem where the main site doesnt go to the 404 error page. if I keep it there, the url rewrite rules I wrote above will work fine.

#11 @Frumph
8 years ago

Okay anyways, uncommenting the noblogredirect in the wp-config.php is the issue.

8 years ago

Okay this is all working, subdirectory, subdomain and shows the info in the network panel.

#12 @Frumph
8 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#13 @wpmuguru
8 years ago

That all works. The problem we have is that the NOBLOGREDIRECT served a dual purpose of both no blog and 404 redirect. As much as I hate to do it, we're going to have to add another constant.

#14 @wpmuguru
8 years ago

(In [14871]) update rewrite rules for IIS, props Frumph, see #12758

#15 @wpmuguru
8 years ago

To prevent the 404 redirect add

define( 'NO404REDIRECT', true );

I wanted to get the patch in before RC, but the


has to be addressed before closing the ticket.

#16 @nacin
8 years ago

That doesn't get fired until template_redirect, so surely we can use a filter here instead...

#17 @Frumph
8 years ago

What would be best would be the display in the network panel how it displays what to put in the web.config should be generated by the same code that actually does it so it doesn't double up on the information. But that can be an update for 3.1 and I can work on that., for now ron's new define works.

#18 @filosofo
8 years ago

remove-indents.12758.diff is my attempt to make things a little more readable.

#19 @wpmuguru
8 years ago

(In [14885]) cleanup $indents, props filosofo, see #12758

#20 follow-up: @Frumph
8 years ago

You do know the indents were there to make things display properly in the networks panel right?

#21 in reply to: ↑ 20 @nacin
8 years ago

Replying to Frumph:

You do know the indents were there to make things display properly in the networks panel right?

The indents are directly in the strings now.

#22 @nacin
8 years ago

(In [14899]) Use a filter instead of a new NO404REDIRECT constant. see #12758.

#23 @wpmuguru
8 years ago

I;m going to apply another improvement to this one and mark it as fixed. If something shows up re-open the ticket.

#24 @wpmuguru
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14911]) allow main site 404 URL to be filtered, fixes #12758

#26 @nacin
8 years ago

(In [15025]) Add some Apache checks to some notices in network.php. see #12758.

#27 @nacin
8 years ago

(In [15026]) Better branching to account for mod_rewrite mimicry. see #12758.

Note: See TracTickets for help on using tickets.