I can't seem to figure out how to rewrite URLs to create dynamic pages with Middleman (3.0.12). Here's my attempt:
activate :directory_indexes
# not found
page "list/*", :proxy => "index.html"
# loads index
page "list/index.html", :proxy => "index.html"
Basically I need to create a simple rewrite rule to forward all list/* traffic to the index page which is then handled by AngularJS's HTML5 router. I know this will work on the live site with htaccess, but developing without it is annoying. Is this possible in Middle Man?
Thanks in advance,
Casey
I got a solution straight from Thomas Reynolds, author of Middleman:
In Gemfile
gem 'rack-rewrite', '~> 1.2.1'
In config.rb
require 'rack/rewrite'
use Rack::Rewrite do
rewrite %r{^\/list(.*)}, '/index.html'
end