Jump to content
usualCommission

Guests cannot see translated page on front end. Redirects to default language.

Recommended Posts

Hello everyone.

I have a multi-language site that has an issue with redirecting the user to the default language if they are not logged in regardless if they have visited a url for another language.

When I am logged in I am able to visit either language fine.

When I'm not logged in I get a 302 redirect to the default language. Example:

/es redirects to / if I'm not logged in. 

 

Share this post


Link to post
Share on other sites

You need to check the rights for the laguages currently not shown to guests. 

The language in general and on a per page base, I believe. 

(Currently on mobile, will provide a jpeg when back in office)

 

  • Like 1

Share this post


Link to post
Share on other sites

You can enable / disable it in the page editor on the settings tab. There is a checkbox for each additional language near the inputfield for the language page name:

language-active-checkbox.jpg.7c07cfb27a7e76800d321db7aa132cec.jpg

 

If you want to check / debug this in your template file(s) for some roles or users, you may add a code snippet like the following:

$languageWarning = '';
if(($user->isSuperuser() || $user->hasRole('NAME_OF_YOUR_EDITOR_ROLE')) && '1' != $page->status1063) {  // active checkbox is not ticked!
        // italien language is disabled !!
        $languageWarning = "<div style='text-align:center; margin:0; padding:0; min-height:30px; background-color:#EEFFEE;  color:red;'>
          !! WARNING: Content for Italian Language is disabled !! <br />
          Go to the settings tab in the editpage and check the box to activate it, if this is by mistake.
		</div>\n";
    }
// change the number from status1063 to that from your language id, or you may derive it programatically from the languages object

In the page markup I output the content of $languageWarning, what only can have content for certain roles or users. Thus the output can stay in markup of production site templates with no harm.

  • Like 2

Share this post


Link to post
Share on other sites

I do remember checking that the URL was enabled on the Home page so it should be available on all of the children pages as well- which has been what I've experienced before. Thanks for the code snippet- I'll start with that to start troubleshooting.

 

Share this post


Link to post
Share on other sites

@horst Thank you for that code. I was able to ensure that the language was being delivered properly. It turns out that the tech managing our in-house web server had very very aggressive caching enabled through Nginx and purging the entire site's cache fixed the issue.

The issues that were coming up didn't look like a caching issue so it was odd. Had odd URL issues and redirect looping. General recommendation to everyone is check with your server admin when all hope is lost...

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...