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``):
155
155
156
156
.. code-block :: yaml
157
157
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
162
163
163
164
.. code-block :: xml
164
165
165
- <!-- config/routes/dev/ framework.xml -->
166
+ <!-- config/routes/framework.xml -->
166
167
<?xml version =" 1.0" encoding =" UTF-8" ?>
167
168
<routes xmlns =" http://symfony.com/schema/routing"
168
169
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
169
170
xsi : schemaLocation =" http://symfony.com/schema/routing
170
171
https://symfony.com/schema/routing/routing-1.0.xsd" >
171
172
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 >
173
176
</routes >
174
177
175
178
.. code-block :: php
176
179
177
- // config/routes/dev/ framework.php
180
+ // config/routes/framework.php
178
181
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
179
182
180
183
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
+ }
184
189
};
185
190
186
191
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