I am unfortunately stuck on a Windows server running a WordPress site. My host has installed iirf
for URL rewriting.
I finally got that working with a little finagling. However the rewrite_rules
within WordPress is not prepending index.php
when the matching rules are generated. Therefore, when the server sends a request like index.php/foo/bar
, WordPress is trying to match it against foo/bar
.
I have created a workaround that prepends index
to the rules before they are recreated.
add_filter('rewrite_rules_array', 'add_index');
function add_index($rules){
foreach ($rules as $rule => $rewrite) {
if(!strpos($rules[$rule],'index.php') !== false) {
unset($rules[$rule]);
$rules['index.php/' . $rule] = $rewrite;
}
}
return $rules;
}
This seems to be functioning correctly at the moment, but it seems that I am covering up an underlying problem. Shouldn't WordPress automatically be creating rules in this manner or is there a setting that I am missing that flags whether to add the index.php
?