Ako nastavit router tak aby ked zadam admin tak ma presmeroval do AdminModule/Homepage/default
- Beliall
- Člen | 5
Momentalne ked zadam mojastanka.sk/admin tak mi vyhodi ze nemam pravo
zobrazit obsah na tomto serveri, to iste mam ked dam admin/sk..ak pouzijem
admin/sk/homepage tak uz to funguje..
ja by som chcel docielit aby ked zadam za domenou admin alebo admin/sk tak ma to
hodilo do adminmodulu a nehlasilo mi chybu..pokial zadam iba admin tak nemam
pravo pristupovat ku zdroju ak pouzijem admin/sk tak sa snazi subor najst
v adminmodule adminmodulu cize adminmodule/adminmodule/homepage/default
moj router vyzera nasledovne
public function createRouter() {
$router = new RouteList();
$router[] = new Route('index.php', 'Store:Homepage:default', Route::ONE_WAY);
# admin
$router[] = $adminRouter = new RouteList('Admin');
$adminRouter[] = new Route('admin/[<lang [a-z]{2}>/]<presenter>/<action>[/<id>]', 'Admin:Homepage:default');
# store
$router[] = $storeRouter = new RouteList('Store');
$storeRouter[] = new Route('[<lang [a-z]{2}>/]<action>', 'Homepage:default');
$storeRouter[] = new Route('[<lang [a-z]{2}>/]<presenter>/<action>[/<id>]', 'Homepage:default');
return $router;
}
Dakujem
- Beliall
- Člen | 5
Hafran napsal(a):
No pro začátek bych změnil to Admin:Homepage:default na Homepage:default to ti podle mě dělá to zdvojení admin/admin jenžto je to v admin routelistu.
Dakujem, z casti si mal pravdu bolo to tam zbytocne, teraz to funguje pokial zadam do url admin\en alebo iny jazyk ale ked zadam iba admin, apache mi vyhlasi chybu ze nemam pravo pristupovat na tomto serveri
- David Ďurika
- Člen | 328
<?php
$adminRouter[] = new Route('admin[/[<lang [a-z]{2}>/]<presenter>/<action>[/<id>]]', 'Admin:Homepage:default');
?>
toto ide ?
Editoval achtan (24. 10. 2013 15:13)
- Beliall
- Člen | 5
Ono vsetko funguje ako ma az na to ked zadam iba admin..pokial dam admin\en\homepage\default nie je problem..
pripajam htaccess
# Apache configuration file (see httpd.apache.org/docs/current/mod/quickreference.html)
# disable directory listing
Options -Indexes
# enable cool URL
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteBase /
# prevents files starting with dot to be viewed by browser
RewriteRule /\.|^\. - [F]
# front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
</IfModule>
# enable gzip compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>