Redirect Everything except 2 URLs

Is there a way to redirect everything on a domain except 2 URLs?

Eg I want to redirect *www.example.com/* but excluding 2 pages: eg www.example.com/page1 and /page2

I keep hitting a wall

Thanks

You would probably want to use a dynamic redirect for this.