remove public from url in zend 2 -
i made changes in files following this link.
it's working $this->basepath() isn't working in layout.phtml, due css , js not loaded
->prependstylesheet($this->basepath('public/css/bootstrap.min.css')) ->prependfile($this->basepath('public/js/html5shiv.js'), 'text/javascript', array('conditional' => 'lt ie 9',)) zendtest/.htaccess
options +followsymlinks -multiviews rewriteengine on rewritebase /zendtest/ rewritecond %{request_uri} !/public [nc] rewriterule ^(.*)$ public/$1 [l] zendtest\module\application\config\module.config.php
return array( 'router' => array( 'routes' => array( 'home' => array( 'type' => 'zend\mvc\router\http\literal', 'options' => array( 'route' => '/zendtest/', 'defaults' => array( 'controller' => 'application\controller\index', 'action' => 'index', ), ), ), 'application' => array( 'type' => 'literal', 'options' => array( 'route' => '/application', 'defaults' => array( '__namespace__' => 'application\controller', 'controller' => 'index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'segment', 'options' => array( 'route' => '/[:controller[/:action]]', 'constraints' => array( 'controller' => '[a-za-z][a-za-z0-9_-]*', 'action' => '[a-za-z][a-za-z0-9_-]*', ), 'defaults' => array( ), ), ), ), ), ), ), zendtest\module\application\view\layout\layout.phtml
<?php echo $this->doctype(); ?> <html lang="en"> <head> <meta charset="utf-8"> <?php echo $this->headtitle('zf2 '. $this->translate('skeleton application'))->setseparator(' - ')->setautoescape(false) ?> <?php echo $this->headmeta() ->appendname('viewport', 'width=device-width, initial-scale=1.0') ->appendhttpequiv('x-ua-compatible', 'ie=edge') ?> <!-- le styles --> <?php echo $this->headlink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basepath() . 'public/img/favicon.ico')) ->prependstylesheet($this->basepath('public/css/style.css')) ->prependstylesheet($this->basepath('public/css/bootstrap-theme.min.css')) ->prependstylesheet($this->basepath('public/css/bootstrap.min.css')) ?> <!-- scripts --> <?php echo $this->headscript() ->prependfile($this->basepath('public/js/bootstrap.min.js')) ->prependfile($this->basepath('public/js/jquery.min.js')) ->prependfile($this->basepath('public/js/respond.min.js'), 'text/javascript', array('conditional' => 'lt ie 9',)) ->prependfile($this->basepath('public/js/html5shiv.js'), 'text/javascript', array('conditional' => 'lt ie 9',)) ; ?> </head> <body>
Comments
Post a Comment