Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12758 closed defect (bug) (fixed)

Better server checks in network.php

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

Description

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 3 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 3 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 3 years ago.

Download all attachments as: .zip

Change History (30)

  • Keywords needs-patch added

Frumph3 years ago

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

  • 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.

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

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

  • Cc ruslany westi added

Please don't do this:

$indent.$indent.$indent

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

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

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.

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.

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

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.

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

Frumph3 years ago

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

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

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.

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

To prevent the 404 redirect add

define( 'NO404REDIRECT', true );

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

$indent.$indent.$indent

has to be addressed before closing the ticket.

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

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.

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

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

comment:20 follow-up: ↓ 21   Frumph3 years ago

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

comment:21 in reply to: ↑ 20   nacin3 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.

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

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

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

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

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

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

Note: See TracTickets for help on using tickets.