Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion cs/routing.texy
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,32 @@ Navíc dojde k automatickému přesměrování na nový tvar URL, takže vám ty

HTTPS
-----
Abychom mohli používat HTTPS protokol, je nutné si správně nakonfigurovat server.

*TODO*
Přesměrování všech adres u již zaběhnuté aplikace lze docílit pomocí souboru .htaccess v kořenovém adresáři naší aplikace za použití permanentního přesměrování s kódem 301.

/--php
<IfModule mod_rewrite.c>
RewriteEngine On
...
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L, R=301]
...
</IfModule>
\--

Routy generují URL se stejným protokolem, s jakým byla stránka načtena. Potřebujeme-li, aby na určité adresy byl použit jiný protokol, použijeme ho v masce routy.

/--php
// Přesměrování na HTTP protokol
$route = new Route('http://%host%/<presenter>/<action>','Homepage:default');

// Přesměrování na HTTPS protokol
$route = new Route('https://%host%/<presenter>/<action>','Admin:default');
\--

.[caution]
HTTPS musí podporovat váš hosting.


Transformace a překlady
Expand Down
27 changes: 27 additions & 0 deletions en/routing.texy
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,35 @@ $router[] = new Route('product/<id>', 'Product:detail');
\--


HTTPS
-----
We need configurate our server for use HTTPS protocol.


Forward all addresses for already well-established applications can be achieved by using .htaccess file in the root directory of our application using a permanent redirect with code 301.

/--php
<IfModule mod_rewrite.c>
RewriteEngine On
...
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L, R=301]
...
</IfModule>
\--

Routes generate URLs with the same protocol, which the page was loaded. If we need, so that certain addresses use other protocol, we use them in mask of route.

/--php
// Forwarding to HTTP protocol
$route = new Route('http://%host%/<presenter>/<action>','Homepage:default');

// Forwarding to HTTPS protocol
$route = new Route('https://%host%/<presenter>/<action>','Admin:default');
\--

.[caution]
HTTPS musí podporovat váš hosting.


Filters and Translation
Expand Down