first draft
This commit is contained in:
52
web/.htaccess
Normal file
52
web/.htaccess
Normal file
@@ -0,0 +1,52 @@
|
||||
# Use the front controller as index file. It serves as a fallback solution when
|
||||
# every other rewrite/redirect fails (e.g. in an aliased environment without
|
||||
# mod_rewrite). Additionally, this reduces the matching process for the
|
||||
# start page (path "/") because otherwise Apache will apply the rewriting rules
|
||||
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
|
||||
DirectoryIndex app.php
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# Determine the RewriteBase automatically and set it as environment variable.
|
||||
# If you are using Apache aliases to do mass virtual hosting or installed the
|
||||
# project in a subdirectory, the base path will be prepended to allow proper
|
||||
# resolution of the app.php file and to redirect to the correct URI. It will
|
||||
# work in environments without path prefix as well, providing a safe, one-size
|
||||
# fits all solution. But as you do not need it in this case, you can comment
|
||||
# the following 2 lines to eliminate the overhead.
|
||||
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
|
||||
RewriteRule ^(.*) - [E=BASE:%1]
|
||||
|
||||
# Redirect to URI without front controller to prevent duplicate content
|
||||
# (with and without `/app.php`). Only do this redirect on the initial
|
||||
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
|
||||
# endless redirect loop (request -> rewrite to front controller ->
|
||||
# redirect -> request -> ...).
|
||||
# So in case you get a "too many redirects" error or you always get redirected
|
||||
# to the start page because your Apache does not expose the REDIRECT_STATUS
|
||||
# environment variable, you have 2 choices:
|
||||
# - disable this feature by commenting the following 2 lines or
|
||||
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
|
||||
# following RewriteCond (best solution)
|
||||
RewriteCond %{ENV:REDIRECT_STATUS} ^$
|
||||
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
|
||||
|
||||
# If the requested filename exists, simply serve it.
|
||||
# We only want to let Apache serve files and not directories.
|
||||
RewriteCond %{REQUEST_FILENAME} -f
|
||||
RewriteRule .? - [L]
|
||||
|
||||
# Rewrite all other queries to the front controller.
|
||||
RewriteRule .? %{ENV:BASE}/app.php [L]
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
<IfModule mod_alias.c>
|
||||
# When mod_rewrite is not available, we instruct a temporary redirect of
|
||||
# the start page to the front controller explicitly so that the website
|
||||
# and the generated links can still be used.
|
||||
RedirectMatch 302 ^/$ /app.php/
|
||||
# RedirectTemp cannot be used instead
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
47
web/app.php
Normal file
47
web/app.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
// This is the front controller used when executing the application in the
|
||||
// production environment ('prod'). See
|
||||
//
|
||||
// * http://symfony.com/doc/current/cookbook/configuration/front_controllers_and_kernel.html
|
||||
// * http://symfony.com/doc/current/cookbook/configuration/environments.html
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* @var Composer\Autoload\ClassLoader
|
||||
*/
|
||||
$loader = require __DIR__.'/../app/autoload.php';
|
||||
include_once __DIR__.'/../var/bootstrap.php.cache';
|
||||
|
||||
// If your web server provides APC support for PHP applications, uncomment these
|
||||
// lines to use APC for class autoloading. This can improve application performance
|
||||
// very significantly. See http://symfony.com/doc/current/components/class_loader/cache_class_loader.html#apcclassloader
|
||||
//
|
||||
// NOTE: The first argument of ApcClassLoader() is the prefix used to prevent
|
||||
// cache key conflicts. In a real Symfony application, make sure to change
|
||||
// it to a value that it's unique in the web server. A common practice is to use
|
||||
// the domain name associated to the Symfony application (e.g. 'example_com').
|
||||
//
|
||||
// $apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
|
||||
// $loader->unregister();
|
||||
// $apcLoader->register(true);
|
||||
|
||||
$kernel = new AppKernel('prod', false);
|
||||
$kernel->loadClassCache();
|
||||
|
||||
// When using the HTTP Cache to improve application performance, the application
|
||||
// kernel is wrapped by the AppCache class to activate the built-in reverse proxy.
|
||||
// See http://symfony.com/doc/current/book/http_cache.html#symfony-reverse-proxy
|
||||
$kernel = new AppCache($kernel);
|
||||
|
||||
// If you use HTTP Cache and your application relies on the _method request parameter
|
||||
// to get the intended HTTP method, uncomment this line.
|
||||
// See http://symfony.com/doc/current/reference/configuration/framework.html#http-method-override
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
39
web/app_dev.php
Normal file
39
web/app_dev.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
// This is the front controller used when executing the application in the
|
||||
// development environment ('dev'). See
|
||||
//
|
||||
// * http://symfony.com/doc/current/cookbook/configuration/front_controllers_and_kernel.html
|
||||
// * http://symfony.com/doc/current/cookbook/configuration/environments.html
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Debug\Debug;
|
||||
|
||||
// If you don't want to setup permissions the proper way, just uncomment the
|
||||
// following PHP line. See:
|
||||
// http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
|
||||
//umask(0000);
|
||||
|
||||
// This check prevents access to debug front controllers that are deployed by
|
||||
// accident to production servers. Feel free to remove this, extend it, or make
|
||||
// something more sophisticated.
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
|
||||
) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Composer\Autoload\ClassLoader $loader
|
||||
*/
|
||||
$loader = require __DIR__.'/../app/autoload.php';
|
||||
Debug::enable();
|
||||
|
||||
$kernel = new AppKernel('dev', true);
|
||||
$kernel->loadClassCache();
|
||||
$request = Request::createFromGlobals();
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
4
web/robots.txt
Normal file
4
web/robots.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
# www.robotstxt.org/
|
||||
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
|
||||
|
||||
User-agent: *
|
||||
Reference in New Issue
Block a user