File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1805,6 +1805,51 @@ with a locale. This can be done by defining a different prefix for each locale
18051805 ;
18061806 };
18071807
1808+ Another common requirement is to host the website on a different domain
1809+ according to the locale. This can be done by defining a different host for each
1810+ locale:
1811+
1812+ .. configuration-block ::
1813+
1814+ .. code-block :: yaml
1815+
1816+ # config/routes/annotations.yaml
1817+ controllers :
1818+ resource : ' ../../src/Controller/'
1819+ type : annotation
1820+ host :
1821+ en : ' https://www.symfony.com'
1822+ nl : ' https://www.symfony.nl'
1823+
1824+ .. code-block :: xml
1825+
1826+ <!-- config/routes/annotations.xml -->
1827+ <?xml version =" 1.0" encoding =" UTF-8" ?>
1828+ <routes xmlns =" http://symfony.com/schema/routing"
1829+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1830+ xsi : schemaLocation =" http://symfony.com/schema/routing
1831+ https://symfony.com/schema/routing/routing-1.0.xsd" >
1832+
1833+ <import resource =" ../../src/Controller/" type =" annotation" >
1834+ <host locale =" en" >https://www.symfony.com</host >
1835+ <host locale =" nl" >https://www.symfony.nl</host >
1836+ </import >
1837+ </routes >
1838+
1839+ .. code-block :: php
1840+
1841+ // config/routes/annotations.php
1842+ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
1843+
1844+ return function (RoutingConfigurator $routes) {
1845+ $routes->import('../../src/Controller/', 'annotation')
1846+ ->host([
1847+ 'en' => 'https://www.symfony.nl',
1848+ 'nl' => 'https://www.symfony.nl'
1849+ ])
1850+ ;
1851+ };
1852+
18081853 .. _stateless-routing :
18091854
18101855Stateless Routes
You can’t perform that action at this time.
0 commit comments