repermalink fails, causing redirect loop on SunOS (Solaris?), and 404 errors.
|Reported by:||SteveBooth||Owned by:|
|Component:||Front-end||Keywords:||Sun SunOS Solaris bb_repermalink redirect loop 404 error|
My web site is hosted on Concentric. Concentric 'Unix' servers appear to be SunOS machines. (You can browse to a phpinfo running on my server here: ( http://stevenmbooth.com/phpinfo.php ) This server provides the following $_SYSTEM variable values when the bb_repermalink routine is invoked from line 5 of index.php in the root directory of bbPress:
REQUEST_URI: (i.e. emptry)
The fact that REQUEST_URI is null causes bb_repermalink to generate a 404 error when index.php is invoked (or, obviously, anyone browses to the root for bbPress.)
Concentric is one of the largest hosting platforms, having spun off from Microsoft several years ago. I would think that Sun support would be fairly important to bbPress.
After reviewing a lot of the code in bb_repermalink, my evaluation is that there are numerous assumptions made about the contents of system variables (in particular REQUEST_URI), that the code is insufficiently rigorous about detecting permalinks (it seems to attempt to redirect uri's that could not possibly be permalinks), and generally is going to be a significant problem with cross-platform support in future versions of bbPress.
My recommendation is, first, to install code similar to this (derived from an plugin supplied by _ck_). I coded it at the front of my bb_repermalink, and it helped, but didn't solve all the problems:
if (isset($_SERVER['REQUEST_URI'])) $uri = $_SERVER['REQUEST_URI']; else if(isset($_SERVER['SCRIPT_NAME'])) $uri = $_SERVER['SCRIPT_NAME']; else $uri = $_SERVER['PHP_SELF']; if (isset($_SERVER['SERVER_NAME'])) $uri = $_SERVER['SERVER_NAME'] . $uri . 'index.php';
However, the uri that this generates is of the form:
Which causes repermalink to create, once again, an endless redirection loop.
More work clearly needs to be done to handle SunOS/Solaris environments, and any system that does not properly supply REQUEST_URI.
(This is 1.0 code by the way. I'm not sure which RC it is (if you tell me where to look, I can tell you) but I think it's RC3.)