Error page displaying 500 An error occurred while updating the database. - Forum | JoomShaper
Solved SP Page Builder

Error page displaying 500 An error occurred while updating the database.

Asked by Peter Dowse 1 year ago Last activity 1 year ago

Accepted answer

Marked as the solution

9 more replies

Ziaul Kabir Staff

Hello Peter,

Thank you for reaching out to us. I sincerely apologize for the inconvenience.

I have disabled the System - Redirect plugin via System > Manage Extensions > Extensions. Could you please check now and let me know if the issue is resolved?

Best regards,

Peter Dowse Asked this

That has fixed it however, I need that plugin published as the redirect component is something we use heavily for SEO.

Is there another fix without having to turn off core functionality?

Ziaul Kabir Staff

You can update this code in the following paths, It will be resolved:

Possible cause: Due to keep new_url field is empty.

Paths: Root Joomla/plugins/system/redirect/src/Extension/Redirect.php on line 245

elseif ($redirect === null) {
            // No redirect object was found, so we create an entry in the redirect table
            if ((bool) $this->params->get('collect_urls', 1)) {
                if (!$this->params->get('includeUrl', 1)) {
                    $url = $urlRel;
                }

                $nowDate = Factory::getDate()->toSql();

                // Add a default value for new_url (can be set to a placeholder or actual value)
                $new_url = 'your-default-url';  // Replace with your actual default URL or logic

                $data = (object) [
                    'id'            => 0,
                    'old_url'       => $url,
                    'new_url'       => $new_url,  // Ensure new_url is included
                    'referer'       => $app->getInput()->server->getString('HTTP_REFERER', ''),
                    'hits'          => 1,
                    'published'     => 0,
                    'created_date'  => $nowDate,
                    'modified_date' => $nowDate,
                ];

                try {
                    $this->getDatabase()->insertObject('#__redirect_links', $data, 'id');
                } catch (\Exception $e) {
                    $event->setError(new \Exception($this->getApplication()->getLanguage()->_('PLG_SYSTEM_REDIRECT_ERROR_UPDATING_DATABASE'), 500, $e));
                    return;
                }
            }
        }

Note: After update joomla, It will gone. (When you redirect don't miss put new url.)

Thanks,

Ziaul Kabir Staff

Hello,

Thanks for your replay. Please, give me your database and file access in hidden content section, So that I can investigate.

Thanks.

Peter Dowse Asked this

When you say file access - do you mean FTP access?

Ziaul Kabir Staff

Yes, You can give me FTP access and database access as well.

Thanks,

Peter Dowse Asked this

Please see hidden area.

Peter Dowse Asked this

Many thanks mate - that's got it.

Ziaul Kabir Staff

You are welcome.

Log in to reply.