Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How 404 page in e107 works? #3179

Open
Jimmi08 opened this issue Jun 8, 2018 · 9 comments
Open

How 404 page in e107 works? #3179

Jimmi08 opened this issue Jun 8, 2018 · 9 comments
Labels
status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. type: question An ask about behavior that is not found documented anywhere

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jun 8, 2018

I thought this:

If I set Redirect to System not found page ON, it will go to file error.php and display content of this page.

But it doesn't work this way. Any 404 displays browser HTTP ERROR 404.

But if I set Associate Root namespace to Page - it will go to page.php and method processViewPage() will display page with this content.

		if(!$sql->gen($query))
		{
		 	header("HTTP/1.0 404 Not Found");
 
			// ---------- New (to replace values above) ----
			
			$this->page['page_title'] = LAN_PAGE_12;			// ***** CHANGED
			$this->page['sub_title'] = '';
			$this->page['page_text'] = LAN_PAGE_3;
			$this->page['comments'] = '';
			$this->page['rating'] = '';
			$this->page['np'] = '';
			$this->page['err'] = TRUE;
			$this->page['cachecontrol'] = false;
              }

define("LAN_PAGE_12", "Invalid page");
define("LAN_PAGE_3", "Requested page does not exist");

I use default e107 htaccess. There is this:

# Custom  pages for php scripts only
<FilesMatch \.php$>
	ErrorDocument 400 /error.php?400
	ErrorDocument 401 /error.php?401
	ErrorDocument 403 /error.php?403
	ErrorDocument 404 /error.php?404
	ErrorDocument 500 /error.php?500
</FilesMatch>

I tried to use absolute path there and nothing.

How this should work?

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jun 8, 2018

Funny, next default installation on the same server, it displays e107 error page. If I set Redirect to System not found page ON, I got browser 404 error.

@Moc
Copy link
Member

Moc commented Jun 19, 2018

@lonalore any thoughts?

@Moc Moc added the status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. label Jun 19, 2018
@Moc Moc added the type: question An ask about behavior that is not found documented anywhere label Jul 5, 2018
@Moc
Copy link
Member

Moc commented Jul 5, 2018

#2148
#2153

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jul 27, 2018

Adding here too:

Could somebody explain me this: google has indexed this url website/?cat.30 - you got message that page listing is turned off, otherwise book/chapter tree is listed. "page" is defined as root namespace.

Why this page doesn't end with 404? This category never existed, last ID is 25...

image

image

@CaMer0n
Copy link
Member

CaMer0n commented Jul 28, 2018

@lonalore will be able to explain. There is another issue I found related to this. If a form includes an image tag pointing to a URL (bla.jpg) and that image is not found, it will now return a 404 error page, and reset the form token. When the form is submitted, the user will get an "Unauthorized Access" message.

I believe we need to limit these error page messages to .php files.
@SimSync Thoughts?

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Aug 7, 2018

With news not existing pages are marked like "soft 404" from google

@SimSync
Copy link
Contributor

SimSync commented Aug 7, 2018

@Jimmi08 I think i found the issue why the redirect didn't work. Please test, once the PR is merged. Thanks!

@CaMer0n CaMer0n closed this as completed in 05d7dcc Aug 8, 2018
CaMer0n added a commit that referenced this issue Aug 8, 2018
Fixes #3179 "Redirect to System not found page" didn't work
@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jun 2, 2019

I think this should stay open. I didn't get an answer to how 404 works.
I try again to explain what I am asking.

url_error_redirect is FALSE

  1. if there is a wrong URL (standalone page, f.e. some mistypo) f.e. contact2.php - URL is not changed and the error page template is displayed.

  2. in the same case but with url_main_module = page, this code is executed:
    function processViewPage()
    if(!$sql->gen($query))
    { ...
    header("HTTP/1.0 404 Not Found"); ...
    }
    (Invalid page, Requested page does not exist)

  3. with /news/ there is only message
    Error 404 - Document Not Found and other news are displayed.

url_error_redirect is TRUE

  1. result is redirection ?route=system/error/404&type=routeError

  2. no change, no redirection, (Invalid page, Requested page does not exist)

  3. no redirection

What I am trying to do? With plugin and e_module to log all 404 urls. Now I am just trying to understand how this works in e107. Thanks

@Moc Moc reopened this Jun 2, 2019
@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Apr 23, 2020

#4137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. type: question An ask about behavior that is not found documented anywhere
Projects
None yet
Development

No branches or pull requests

4 participants