I just installed a friends blog on my LAMP stack, which has mod_rewrite enabled (I’m using it for clean URLs on my Drupal installs on the same server). For some reason, WordPress (3.0.3) isn’t recognizing that mod_rewrite is enabled. In the Permalinks menu it’s displaying options for PATHINFO permalinks (with index.php preceding the url string).
My fix for now was to just use the Custom Structure field and input what I wanted less the index.php part WordPress seems intent on inserting, which works but I’d like to get an actual fix for this in place.
Is this a 3.0.3 anomaly? I haven’t had much time to investigate my server configuration, but any guidance would be much appreciated.
The output of $_SERVER[‘SERVER_SOFTWARE’] is WebServerX
That looks like your problem – check out this line in
/** * Whether the server software is Apache or something else * @global bool $is_apache */ $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
I think you’ll need to override this variable manually, either in a plugin or your theme’s
global $is_apache; $is_apache = true;
Props to @John P Bloch:
The only time it’ll automatically add ‘index.php’ to a permalink is if $is_apache returns false.
Alternatively you can add the following line of code to your functions.php file:
add_filter( 'got_rewrite', '__return_true', 999 );
We’re doing this to make WordPress play well with nginx.