Skip to content


rewrites for Windows IIS #73

frissony opened this Issue · 9 comments

4 participants


I find that the page rendered in the browser is using URLs like <link rel="stylesheet" href="/css/blueprint/screen.css">.

If I use the complete path to the css file, things work.

Seems like a bug in roots theme since the WordPress default Twenty Ten theme works just fine (though it does not use relative URIs like roots is using).

What is the fix for this problem?

Roots member

just renamed the title of this issue to reflect the full problem (it's not just the css). the problem is that the rewrites we do in generate .htaccess rules and not rules for web.config

once someone figures out the rules i'll add them onto the wiki (like how we did with rewrites for nginx, see


I tried a lot playing around with IIS rewrites - IIS does no rewriting at all. Logs are always showing 404.

I guess roots is unusable for me until this gets sorted out.

Thanks anyway.

@frissony frissony closed this
@frissony frissony reopened this
Roots member

IIS does do rewriting.. how do you think permalinks work for wordpress? it's just a matter of creating them. you don't have to use the rewrites to use roots, just comment out the appropriate lines in the cleanup file


I meant that I made rewrite rules to rewrite /css/style.css to /wp-content/themes/roots/css/style.css and that IIS was seeming to do nothing about that rewrite - it was ignoring that rewrite rule (I checked the option to log the rewrite rule, and that did not log the rule to the log file; I did also test the rule using the test dialog in IIS - that's working fine).

Not sure what I need to do so that IIS is able to serve (for example) style.css - right now the IIS log shows 404 for requests to that file (among others).

What I tried:

Create a rewrite rule:

Pattern: ^/css/(.*)$
Action type: Rewrite
Rewrite URL: /wp-content/themes/roots/css/{R:1}
Log rewritten rule is checked


Hi I managed to get the rewrite rules to work after installing this in IIS, based on this post
hope that helps.

Was there another solution?

Roots member

haven't heard anything - could you please add an IIS page to the wiki with instructions on how you got it to work?

Roots member

i just read over the article you linked, after installing ISAPI_Rewrite 3 are you able to just use the same exact .htaccess rules on IIS?

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^css/(.*) /wp-content/themes/roots/css/$1 [QSA,L]
RewriteRule ^js/(.*) /wp-content/themes/roots/js/$1 [QSA,L]
RewriteRule ^img/(.*) /wp-content/themes/roots/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

or does it need to be further modified?

Roots member should handle this. will add a reference to it in the wiki with #264

@retlehs retlehs closed this

I've created a gist that has the rewrite rules working within the IIS web.config:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.