[Locked] 404 - Too Many Redirects - Question | JoomShaper

[Locked] 404 - Too Many Redirects

S

SPD

Helix Framework 1 year ago

Hi, Trying to create a custom 404 page and following this article: https://www.joomshaper.com/blog/create-a-custom-joomla-404-page-with-sp-page-builder

I have tested the page via the menu and all works well but when I implement the change to the error.php... https://drive.google.com/file/d/1ykhg6ror7BwAAPW4sTIVBaFsQd2k4FFJ/view?usp=sharing

... I get another error of too many redirects. Maybe a problem with where I am placing code. Tried various position, the last one being at the very top of the file. Link above is the code I currently have

0
15 Answers
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #97163

I just added this code and change the id 10 with 221 (which is came from menu id)

https://prnt.sc/_s47M7s-tEYd

// custom 404 redirect
$config = JFactory::getConfig();
$sef = $config->get('sef');
$sef_rewrite = $config->get('sef_rewrite');
$sef_suffix = $config->get('sef_suffix');
$redirect_url = JURI::base();
if(!$sef_rewrite) {
    $redirect_url .= 'index.php/';
}
$redirect_url .= '404'; // menu alias
if($sef_suffix) {
    $redirect_url .= '.html';
}
// if sef is turned off
if(!$sef) {
    $redirect_url = 'index.php?option=com_sppagebuilder&view=page&id=10';
}
if (($this->error->getCode()) == '404') {
    header('Location: ' . $redirect_url, true, 301);
    exit;
}

code should be placed just under - defined ('_JEXEC') or die();

Check the screenshot

https://www.joomshaper.com/images/2020/09/04/custom-404.jpg

0
S
SPD
Accepted Answer
1 year ago #96320

Hi, I understand you're busy but hoping this could be an easy win. Any thought on what might be cuase my issue. I had forgotten to say using SP PB 3.8.9 and latest version of Helix Thank You

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #96536

Hi there,

Thanks for contacting us. Sorry for the inconvenience. Will you please provide me the Joomla administrator access to check the issue? I will check & get back to you soon. 

-Thanks

0
S
SPD
Accepted Answer
1 year ago #96572

Info in hidden, but this is on a test subdomain so I will need to know what you did so I know what to do when I apply it to the live site. Thank you

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #96728

Please give me super administrator access. Thanks

0
S
SPD
Accepted Answer
1 year ago #96847

done

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #96927

Please check now. Thanks

0
S
SPD
Accepted Answer
1 year ago #96972

Cheers, works great but that is a test site so I need to know what you did so I can set it up correctly on my Live site

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #97069

Changed menu name and alias then replace the code again.

0
S
SPD
Accepted Answer
1 year ago #97071

So just so I can make note of what is not in article. The following is required when replace error 404 page

  • the menu name must match the in article OR you must update the code (// menu alias)
  • menu can not be a submenu as I see you did move that too
  • code should be placed just under - defined ('_JEXEC') or die();
0
S
SPD
Accepted Answer
1 year ago #97192

I am pretty sure I had already added code , especially since the existing one still has my comments in it. Unfortuntely I didn't take a backup of that file before you went in and changed so I couldn't tell for certain.

While I thank you for fixing the file and I can understand that it is often easier as tech support/developer to just go in and see what is happening and change it... as the customer and developer of site, it is actually not ideal. I have no idea what has been done as you don't make any notes or comments which in the end just requires me to wait even longer to get the actual information I need as I have to come back and ask.

I need to learn how to fish, where you're just giving me one... if you know that proverb. ;-)

Anyway, thanks again for help

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #97288

You are most welcome. Will you please spend some to write a review about our product and support quality? 

https://extensions.joomla.org/extension/sp-page-builder/

https://www.trustpilot.com/review/www.joomshaper.com

0
LW
Lisa Willaman
Accepted Answer
1 year ago #101360

I am having the exact same issue as the original poster.

Based on this post, I have no idea how to fix it except to give admin access to my site and have it fixed for me.

If, instead, exact instructions were provided, Joomshaper staff would stop getting the same request for a fix for this issue.

In other words, we would all be taught to fish, not just given a fish.

Can a fix please be explained here or can the blog post instructions be updated? https://www.joomshaper.com/blog/create-a-custom-joomla-404-page-with-sp-page-builder

Thank you. Lisa W.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 1 year ago #101567

@Lisa Willaman Can you give me administrator access to check your issue? Thanks

0
S
SPD
Accepted Answer
1 year ago #109155

This is old post, figured noone will read but want to mention somewhere. First though, I'd like to thank Toufiq for my outloud laugh at thier reponse to Lisa's request. There was a tear, I swear.

Any way, the reason I am posting this in old thread as I have just discovered why the soluion povided is not the best as applying an update to the Helix Framework will the error.php and the changes you would have made. I can undstad if there is no better solution, just thought would mention since I ran int the same issue when implmenting the proposed changes from the article.

You will also get the too many redirects if you named your Menu Item for the Error Page anything but 404. If you did, you also need to update this line to you menu ALIAS:

$redirect_url .= '404'; // menu alias - Change to your menu alias 

Ah to think how many fish I coulda caught while re-doing this ;-)

0
This topic is locked