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

eZ Community » Forums » eZ Publish 5 Platform » PathPrefix and site translation problem

PathPrefix and site translation problem

PathPrefix and site translation problem

Wednesday 06 February 2013 8:11:04 am - 5 replies



I have the following website structure:


– page1

– page2

– Blog

– – article1

– – article2


IndexPage in the MySite site.ini file points to the MySite node.

IndexPage in the Blog site.ini file points to the Blog node.


So, MySite available from this url:

and the Blog available from this url:


By default my blog article available from this url:

To remove the "Blog" word from the url I have added PathPrefix=Blog to the Blog site.ini file. Now I can read an article using this url:

OK, everything works fine! 


But when I add a new language (russian) to my blog, the "Blog" word appears again in the article url when I want to translate it.

When I go to 

and click this url:<article1_node_id>

EZ5 (in legacy_mode) redirects me to

and the "Blog" word appears in the url again.


How to remove the "Blog" word from the blog urls in all situations???

Thank you in advance.

Modified on Wednesday 06 February 2013 8:14:51 am by Felix Ratnik

Wednesday 06 February 2013 10:32:21 am

Did you add


to the *.ru siteaccess site.ini?



Wednesday 06 February 2013 1:49:56 pm

Yes, but it doesn't help.

Any other hints?

Wednesday 06 February 2013 3:34:41 pm

But if you use what happens?

Wednesday 06 February 2013 7:22:26 pm


The url works fine. I can open it without any problems. But the LanguageSwitcher translation of this page redirects me to (I don't need the "Blog" word in this url).

I opened the source code of the ezpLanguageSwitcher class (located here: ezpublish_legacy/kernel/private/classes/ezplanguageswitcher.php) and found that it doesn't support PathPrefix variable at all.

There are no settings that can solve my problem since LanguageSwitcher source code doesn't contain any checks for the PathPrefix variable.

So, to fix this I have added the following code:

// Add PathPrefix if needed
$ini = eZINI::instance();
$pathPrefix = $ini->variable( 'SiteAccessSettings', 'PathPrefix' );
if ( $this->origUrl != '' && $pathPrefix != '' )
    $this->origUrl = $pathPrefix . '/' . $this->origUrl;

to the __construct( $params = null ) function in the ezpLanguageSwitcher class.

And the following code:

// Remove PathPrefix if needed
$ini = eZINI::instance();
$pathPrefix = $ini->variable( 'SiteAccessSettings', 'PathPrefix' );
if ( $urlAlias != '' && $pathPrefix != '' )
    $pathPrefix .= '/';
    if ( strncmp( $urlAlias, $pathPrefix, strlen( $pathPrefix ) ) == 0 )
        $urlAlias = substr( $urlAlias, strlen( $pathPrefix ) );

to the destinationUrl() function in the same class.

After that all problems have been instantly solved. All urls work just fine.

I think that this fix must be added to the next EZ Publish release.

What do you think about this?

Modified on Wednesday 06 February 2013 7:34:17 pm by Felix Ratnik

Thursday 07 February 2013 11:09:29 pm

Hello Felix, I don't know ezpLanguageSwitcher class so I can't give you an opinion about this fix happy.gif Emoticon

However you can open a issue in and propose you patch



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

36 542 Users on board!

Forums menu

Proudly Developed with from