CSS isn’t working corectly on IIS 7.5 using Helicon Zoo and Sinatra.
Here is the directory structure:
welcometo
--public
--styles
--welcometo.css
I tested my site using Webrick and it works perfectly.
When I go to localhost:4567/styles/welcometo.css, the style sheet is displayed in the web browser.
When I go to the IIS site /styles/welcometo.css I get this error:
Try this:
get '/public/styles/welcometo.css' do
"Hello World"
end
I copied the web.config from Helicon Zoo’s Sinatra page. Here is the Static files section:
<!-- Send static files through IIS -->
<rewrite>
<rules>
<rule name="Avoid Static Files" stopProcessing="true">
<match url="^(?!public)(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="public/{R:1}" />
</rule>
</rules>
</rewrite>
Any ideas?
We forget to include the web.config example for /public folder, sorry. You can see this example on the page for Ruby on Rails installation here: Ruby on Rails (2.3.x and 3.x.x) on IIS
Please put this web.config file into the /public folder: