From 73cd160bfc6e4a1b88f2117eb0c097a91ac5c753 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 14 Jan 2016 18:15:07 +0100 Subject: Switch to Symfony 3 structure --- web/.htaccess | 22 +++++++++++++++++----- web/app.php | 2 +- web/app_dev.php | 2 +- web/robots.txt | 4 +++- 4 files changed, 22 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/.htaccess b/web/.htaccess index b52e3ae6..4dc72516 100644 --- a/web/.htaccess +++ b/web/.htaccess @@ -5,6 +5,18 @@ # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). DirectoryIndex app.php +# By default, Apache does not evaluate symbolic links if you did not enable this +# feature in your server configuration. Uncomment the following line if you +# install assets as symlinks or if you experience problems related to symlinks +# when compiling LESS/Sass/CoffeScript assets. +# Options FollowSymlinks + +# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve +# to the front controller "/app.php" but be rewritten to "/app.php/app". + + Options -MultiViews + + RewriteEngine On @@ -18,9 +30,9 @@ DirectoryIndex app.php RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ RewriteRule ^(.*) - [E=BASE:%1] - # Sets the HTTP_AUTHORIZATION header removed by apache + # Sets the HTTP_AUTHORIZATION header removed by Apache RewriteCond %{HTTP:Authorization} . - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect to URI without front controller to prevent duplicate content # (with and without `/app.php`). Only do this redirect on the initial @@ -34,15 +46,15 @@ DirectoryIndex app.php # - 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] + RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [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] + RewriteRule ^ - [L] # Rewrite all other queries to the front controller. - RewriteRule .? %{ENV:BASE}/app.php [L] + RewriteRule ^ %{ENV:BASE}/app.php [L] diff --git a/web/app.php b/web/app.php index cc2fefb5..5c5ee03b 100644 --- a/web/app.php +++ b/web/app.php @@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Request; * @var Composer\Autoload\ClassLoader */ $loader = require __DIR__.'/../app/autoload.php'; -include_once __DIR__.'/../app/bootstrap.php.cache'; +include_once __DIR__.'/../var/bootstrap.php.cache'; // Enable APC for autoloading to improve performance. // You should change the ApcClassLoader first argument to a unique prefix diff --git a/web/app_dev.php b/web/app_dev.php index 635bf7ac..8456754d 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -12,7 +12,7 @@ use Symfony\Component\Debug\Debug; // 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'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server') + || !(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.'); diff --git a/web/robots.txt b/web/robots.txt index 77470cb3..214e4119 100644 --- a/web/robots.txt +++ b/web/robots.txt @@ -1,2 +1,4 @@ +# www.robotstxt.org/ +# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 + User-agent: * -Disallow: / \ No newline at end of file -- cgit v1.2.3