-
-
Save mjc/8420610 to your computer and use it in GitHub Desktop.
config.ru for running CakePHP apps under Pow. Includes an app/webroot rewrite and some other things from the rack-legacy example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
require 'rack-legacy' | |
require 'rack-rewrite' | |
webroot = File.join(Dir.getwd,'app','webroot') | |
use Rack::Rewrite do | |
rewrite %r{/(.*)}, lambda { |match, rack_env| | |
File.exists?(File.join(webroot,match[1])) ? File.join('app','webroot',match[1]) : '/app/webroot/index.php/%s' % match[1] | |
} | |
rewrite '/', 'index.php' | |
end if File.exists?(webroot) | |
use Rack::ShowExceptions | |
use Rack::Legacy::Index | |
use Rack::Legacy::Php, Dir.getwd | |
use Rack::Static, :urls => %w{/css /files /img /js /favicon.ico}, :root => webroot | |
run Rack::File.new Dir.getwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hice nice one, but which directory should i save this config file