404 Error is a problem

Bob Weston Posted in Technical Support 6 days ago

Hi,

I read this thread:
https://www.opensource-socialnetwork.org/discussion/view/1839/how-can-i-get-rid-of-the-404-page-error
and would think this issue was resolved since it was four years ago.
I am using v5.5TLS premium and every time you go close the browser from a page other than the news feed, then reopen the browser a 404 page comes saying "The page you requested was not found". This is due to the fact that you are automatically logged out every time you close the session (which is also not good). Is there a work around for this? Maybe place a redirect in the "exceptions.php"? If so, how would I go about doing this?

Replies
German ~Z~ Man Replied 6 days ago

Okay folks,
I just uploaded GreenByGreen 1.30 which comes with it's own error page anyway since V 1.27
It does an automatic redirect to the startpage now if necessary - so members can relogin easily.
see plugins/default/pages/contents/error.php

us Michieal ~ Coder ~ Replied 6 days ago

You're very welcome.

I still would like to see this fixed... but at least, there's a work around :D

German Bob Weston Replied 6 days ago

Thanks Michieal.. your code works great.. at least when someone gets the 404 error they can just click on the logo to login..

us Michieal ~ Coder ~ Replied 6 days ago

@Bob_Weston

To make the logo a button, change your theme code (topbar.php under elements) to be this:

        <span><a href="<?php
            if (ossn_isLoggedin()) {
                echo ossn_site_url('home');
            } else {
                echo ossn_site_url('login');
            } ?> 
            "><img src="<?php echo ossn_theme_url(); ?>images/toplogo.png"/></a></span>

You should recognize where it goes, as you were the one that posted that you could change the sitename in the topbar to a logo. But, it should be line 20, in "/themes/goblack/plugins/theme/page/elements/topbar.php"

us Michieal ~ Coder ~ Replied 6 days ago

@~Z~ Man

A good url to test it with, is /notifications/all... if you close the page and wait for the cookie to expire, you will see the 404 error code.

It's the PrivateNetwork Component, and ~line 78 is the redirect. However, with a little bit of experimentation, I cannot get it to redirect out of the error code to the login page, which is logically where it should go to.
Here's what I tried:

    private function deney() {
    global $Ossn;
    ossn_trigger_message(ossn_print("private:network:deney"), 'error');
    $url = ossn_site_url('login');
    if (ossn_is_xhr()) {
        $Ossn->redirect = $url;
    } else {
        header("Location: {$url}");
        exit;
    }
}

I also tried "redirect('login');" and "redirect(ossnsiteurl('login');" When those failed, I copied the redirect code and pasted it in... again to no avail.

PS. Deny is spelled wrong in the component.

German Bob Weston Replied 6 days ago

if you would like to see for yourself.. my website is rebellion-network.com
It is new and have very few members right now.. I don't want to advertise too much until I get everything working right..

German Bob Weston Replied 6 days ago

Hi guys..
I have only noticed it on my iPhone so far using the Safari browser.. if I am on any page on the website.. for example, reading a message someone sent me.. and I close the browser, when I reopen it I get a 404 page and cannot do anything but retype the link above so it takes me to the login page. The only time it works properly is if I close my browser while on any page that isn't private.. like public groups or profiles and such.. but even there, there is no menu to click so you still have to type the link in again.

An easy fix would be to have a public button to return to the index.. but I have no knowledge to do that or on what page it should be placed.. I guess i could make the logo a button somehow..

us Michieal ~ Coder ~ Replied 6 days ago

@~Z~ Man,
I can help shed some light on this, as I too have witnessed it.
Browser: Firefox Quantum Developer Edition, Chrome, Edge.
OS: Windows 10.
Device: My computer, specifically, my development rig; 32 gb memory, amd ryzen 3700, 8 tb drive.
OSSN Version: v5.5TLS premium (made 2 weeks ago ish.)
Page: EVERY page EXCEPT for the Login page, and the Admin Dashboard.

I'm popping in, because this was on my own TODO: list.

German ~Z~ Man Replied 6 days ago

Please provide a sample url of a page which is being redirected to the 404 page
and the Operating system, Browser, and device you're using