Skip to content

Instantly share code, notes, and snippets.

@sbosell
Created February 18, 2014 01:10
Show Gist options
  • Save sbosell/9062637 to your computer and use it in GitHub Desktop.
Save sbosell/9062637 to your computer and use it in GitHub Desktop.
Umbraco Angular Rewrite Rules
<rewriter>
<!-- ignore all umbraco routes -->
<rewrite url="^(/umbraco/.*)" to="$1" processing="stop" />
<!-- ignore all images, css, html fragments -->
<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.html|\.less|\.htm)(\?.+)?)$" to="$1" processing="stop" />
<!-- if the header contains app we know it is a call to get a template. We need to let it pass -->
<if header="app" match="true">
<rewrite url="(.*)" to="$1" processing="stop"/>
</if>
<!-- if google is indexing let's let it proceed and get all non angular views which is just the normal umbraco views with razor -->
<if header="HTTP_USER_AGENT" match="Googlebot">
<rewrite url="(.*)" to="$1" processing="stop"></rewrite>
</if>
<!-- Provides a way to allow users to link directly to a page -->
<unless url="(^/$)|(!)">
<redirect url="/(.*)" to="/#!$1" process="stop"></redirect>
</unless>
</rewriter>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment