wordpress 3.1 on iis6 – redirect hell

I’ve been having a nightmare setting up wordpress 3.1 on iis6

So here are my notes

I’m using IIRF with the following set up

RewriteLog c:\temp\iirf
RewriteLogLevel 3
MaxMatchCount 1
RewriteEngine On
IterationLimit 4
StatusInquiry ON
# Do not pass to wordpress if the file or directory exists
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^/wp-(.*)$ - [L,I]
RewriteRule ^/$ - [L,I]
RewriteRule ^/(.*(js|ico|gif|jpg|png|flv|swf|css))$ /$1 [L,I,U]
RewriteRule ^/(?!wp-[^\?\/]*)([^\?]+)$ /index.php [L,I,U]

This works fine, for all pages apart from the homepage (anyone more fluent in regex’s is welcome to assist me if I could have been cleverer).

To stop the homepage going in an infinite loop redirecting to itself, I have installed this plug in http://wordpress.org/extend/plugins/permalink-fix-disable-canonical-redirects-pack/

…and then, since I’m not using query strings in my permalinks, I edited it as follows:
add_action('init', 'requesturipow_init');
function requesturipow_init() {
  {
   // --- thirzah fix since don't want q's
   // if(isset($_REQUEST['q'])) {
   // $_SERVER['REQUEST_URI'] = "/" . $_REQUEST["q"];
 
   if(isset($_SERVER["HTTP_X_REWRITE_URL"])) {
   $_SERVER['REQUEST_URI'] = "/" . $_SERVER["HTTP_X_REWRITE_URL"];
   // --- end of thirzah fix
  }else{
  if (empty($_SERVER['QUERY_STRING'])) {
  $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
      } else {
  $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . "?" .
  $_SERVER['QUERY_STRING'];
      }
    }
  }
}
remove_filter('template_redirect', 'redirect_canonical');
 

Posted in Misc | Leave a comment

Posterous 2nd test via email

duh, I re-read the instructions, it says to put tags in the subject :)

Posted in www | Leave a comment

Posterous test via email

and this is a test sent to posterous via email
((tag: posterous, email, tests, www)).
Posted in Misc | Leave a comment

Testing out Posterous

This is a post sent via posterous.com

There’s not much more I can say, other than, I should be sending one via email shortly ;)

Posted in Misc | Leave a comment

I.E’s pesky setattribute thingummies

I’ve been pulling my hair out trying to get a div style to change from an onClick event.  I found a lot of examples explaining that ie uses className instead of class, but my fundamental issue was that when I iterated through a div’s attributes I could see it’s value, but when I used getAttribute/setAttribute, it was just nulls all round.

Anyway, long story short, this seems ugly but works on firefox and ie8.  Just use something like  
<div id=”changeit” class=”oldclass”><a href=# onClick=”chEleClass(‘changeit’, ‘newclass’)”>change it</a></div>

to trigger:

function chEleClass(ele, cls) {

var sAttr = (window.clientInformation) ? “className” : “class”;

if (sAttr==”className”) {
 eval(‘document.getElementById(\”‘+ ele + ‘\”).’ + sAttr + ‘=\”‘ + cls + ‘\”;’)
}
else {
 document.getElementById(ele).setAttribute(sAttr, cls,0);
}

}

Posted in www | Tagged , , | Leave a comment