A
A
Alexander2018-03-19 11:49:41
Joomla
Alexander, 2018-03-19 11:49:41

How to serve static content to a guest?

There is a desire for site guests to give a static version of the site, without unnecessary twitching of php / database. Are there any solutions for this?
ps I know about Joomla caching.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Gruznykh, 2018-03-25
@Captain

Don't know if it will work, taken from here . The point is to use Joomla to check if a given visitor is logged in and, if not, redirect him to a static html page.
It should be in templates/your_template/index.php

$user = JFactory::getUser();
$app  = JFactory::getApplication();

if ($user->id != 0)
{
    // залогиненный юзер, ок
    // сюда всё остальное содержимое index.php
}
else 
{
    // редиректим незалогиненного на статичную страницу
    $app->redirect(JRoute::_('page.html'));
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question