Alternative Rewrite Rules

Instead of the usual litany of rewrite rules generated by WordPress, I’m using this abbreviated form for this site.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1

This simply takes the requested URI and feeds it to index.php as PATH_INFO. The PATH_INFO handler in WP takes it from there. There’s no need to update .htaccess when new rules are introduced or when the permalink structure changes. All of the rewrite juggling is handled internally by WP. This cuts mod_rewrite out of the picture except for the initial handoff. This avoids the various mod_rewrite idiosyncracies across different versions of Apache by doing an end-run around them. I like it.

4 thoughts on “Alternative Rewrite Rules

  1. Pingback: Schlueterica
  2. Pingback: Seong Eun's Blog

Comments are closed.