File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -155,32 +155,37 @@ automatically when installing ``symfony/framework-bundle``):
155155
156156 .. code-block :: yaml
157157
158- # config/routes/dev/framework.yaml
159- _errors :
160- resource : ' @FrameworkBundle/Resources/config/routing/errors.xml'
161- prefix : /_error
158+ # config/routes/framework.yaml
159+ when@dev :
160+ _errors :
161+ resource : ' @FrameworkBundle/Resources/config/routing/errors.xml'
162+ prefix : /_error
162163
163164 .. code-block :: xml
164165
165- <!-- config/routes/dev/ framework.xml -->
166+ <!-- config/routes/framework.xml -->
166167 <?xml version =" 1.0" encoding =" UTF-8" ?>
167168 <routes xmlns =" http://symfony.com/schema/routing"
168169 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
169170 xsi : schemaLocation =" http://symfony.com/schema/routing
170171 https://symfony.com/schema/routing/routing-1.0.xsd" >
171172
172- <import resource =" @FrameworkBundle/Resources/config/routing/errors.xml" prefix =" /_error" />
173+ <when env =" prod" >
174+ <import resource =" @FrameworkBundle/Resources/config/routing/errors.xml" prefix =" /_error" />
175+ </when >
173176 </routes >
174177
175178 .. code-block :: php
176179
177- // config/routes/dev/ framework.php
180+ // config/routes/framework.php
178181 use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
179182
180183 return function (RoutingConfigurator $routes) {
181- $routes->import('@FrameworkBundle/Resources/config/routing/errors.xml')
182- ->prefix('/_error')
183- ;
184+ if ('dev' === $container->env()) {
185+ $routes->import('@FrameworkBundle/Resources/config/routing/errors.xml')
186+ ->prefix('/_error')
187+ ;
188+ }
184189 };
185190
186191 With this route added, you can use URLs like these to preview the *error * page
You can’t perform that action at this time.
0 commit comments