This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » EzPublish 5 - 404 and Multisite
expandshrink

EzPublish 5 - 404 and Multisite

EzPublish 5 - 404 and Multisite

Monday 06 October 2014 3:57:20 pm - 4 replies

Hi,

I've installed EzPublish version 2014.7 and I've 2 website with one BO (Multisite).

I want create 2 pages 404 because the design is different. But only the first 404 page is ok.

Example : I create Abx/MyFirstSiteBundle (http://www.myfirstsite.com) and Abx/MySecondSiteBundle (http://www.mysecondsite.com). If I submit http://www.myfirstsite.com/blabla, my 404 page is ok. But if I submit http://www.mysecondsite.com/blabla, my 404 page is there www.myfirstsite.com

I create my SiteRouter.php, notFound.html.twig and services.yml for myfirstsite and mysecondsite and modify DefaultController for MyFirstSiteBundle :

public function notFoundAction()    {
        return $this->render('AbxMyFirstSiteBundle:Error:notFound.html.twig');    
}

and for MySecondSiteBundle :

public function notFoundAction()    {
        return $this->render('AbxMySecondSiteBundle:Error:notFound.html.twig');    
}

Did I miss something ?

P.S : Sorry for my english happy.gif Emoticon

Monday 06 October 2014 4:18:31 pm

You have both bundles active at the same time?
How are you specifying which handler to use?

I think you will have to to create a site aware error handler and return the correct controller accordingly.

You could look at using something like LiipThemeBundle if it is only the template that is different.

Tuesday 07 October 2014 9:44:17 am

Hi Douglas,

Yeah 2 bundles are active, you're right. For my multisite, I use 2 bundles : Abx/MyFirstSiteBundle and Abx/MySecondSiteBundle.

In my ezpublish.yml, i put this :

 siteaccess:
    default_siteaccess: siteone
    list:
        - siteone
        - sitetwo
        - myadmin

And in my parameters.yml :

ezpublish_legacy.siteone.view_default_layout: 'AbxMyFirstSiteBundle::pagelayout.html.twig'
ezpublish_legacy.sitetwo.view_default_layout: 'AbxMySecondSiteBundle::pagelayout.html.twig'

I think my problem is here. Ez load my first SiteRouter and that's all... If I put an exit() on my siterouter.php to my bundle Abx/MySecondSiteBundle, nothing happens...

I use this method : https://gist.github.com/quantumlord42/3a010e85983bae634dc6

Is it possible to have two 404 pages differents for 2 bundles ? (one in each bundle)

I found a solution but it's not a good solution. In my first siteRouter.php in Abx/MyFirstSite, I check my variable $siteaccess....

Thx

Modified on Tuesday 07 October 2014 10:23:49 am by Stéphane Savona

Tuesday 07 October 2014 3:34:57 pm

At first look your router always calls:

return array('_route' => 'error','_controller' => 'ProjectSiteBundle:Error:NotFound',);

ProjectSiteBundle:Error:NotFound will always be used except for when ResourceNotFoundException is thrown.  You still will have to add logic to this controller or a custom error handler the to select the correct controller::notfoundAction based on site access.

You can check out http://symfony.com/doc/current/cookbook/controller/error_pages.html to see how to create your own exception controller.

Modified on Tuesday 07 October 2014 3:37:22 pm by Douglas Hammond

Wednesday 08 October 2014 3:18:03 pm

Thx Douglas

I'll look this side happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from