1
tzvook
Help with Error redirections
  • 2020/5/13 15:32

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Hi
I need a little help with an issue I experienced lately ...
I'm using Xoops for years and never saw it before : from some reason google generates weird links to my site: https://www.mysite.com/?page_id=23 and https://www.mysite.com/?page=23 and so on ..

since Xoops always answer it with the front-page, google see all content in the front page as double content and all links as spam.

I tried redirecting with the ..htaccess without success
ErrorDocument 400 /404.php
ErrorDocument 401 
/404.php
ErrorDocument 403 
/404.php
ErrorDocument 404 
/404.php


My Configuration:
PHP: 7.2.24
XOOPS: 2.5.10

2
Mamba
Re: Help with Error redirections
  • 2020/5/13 23:15

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


I couldn't find any info about such behavior, except this:
https://stackoverflow.com/questions/8764288/href-automatically-adds-to-current-page-url-in-php-cant-figure-it-out

What module exactly is it doing? Are the URL links in headers of that module not generated correctly?
https://support.google.com/webmasters/answer/9112205?hl=en
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
tzvook
Re: Help with Error redirections
  • 2020/5/13 23:29

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


I don't think that something caused it ... it's probably a mistake or an old link, but the fact that XOOPS is not using some kind of ERROR page mechanism keep those links forever ... since it don't inform google that it's an Error ... and that makes all external links on your homepage "spam links" ...

All your competitors need to do is plant links like "https://xoops.org/?page=23" somewhere ... and they sabotage your site ... since now google see all homepage links on 2 pages ...

4
tzvook
Re: Help with Error redirections
  • 2020/5/14 13:49

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


So ?
Is there a solution to this auto redirect ?

5
goffy
Re: Help with Error redirections
  • 2020/5/14 19:52

  • goffy

  • Just can't stay away

  • Posts: 543

  • Since: 2010/12/27


Hi

are you using google search console? With this tool maybe you can find out where the problem is

6
Mamba
Re: Help with Error redirections
  • 2020/5/15 2:36

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Tzvook, try this module and see if it helps: https://github.com/mambax7/xhttperror

This module requires that the server supports .htaccess files (and that .htaccess files are allowed for your account), or some way for you to add custom error message redirects.

ErrorDocument 404 [xoops_url]/modules/xhttperror/index.php?error=404
ErrorDocument 500 
[xoops_url]/modules/xhttperror/index.php?error=500
ErrorDocument 403 
[xoops_url]/modules/xhttperror/index.php?error=403
ErrorDocument 403 
[xoops_url]/modules/xhttperror/index.php?error=[status code]

Where [status_code] is the status code for server errors and [xoops_url] is the URL to your main XOOPS directory WITHOUT trailing slash (http://yoursite.com)

That was a module that Luciorota was working on, so I don't know much about the internals, but in the help there were links to:
https://www.iana.org/assignments/http-status-codes/http-status-codes.xml
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

To set up this module you need to:
- configure your preferences for the module;
- edit existing Errors codes or add new ones and update the .htaccess file.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

7
geekwright
Re: Help with Error redirections

I just want to make sure what you are asking for.

As I read this, it sounds to me that you want to intercept a URL
XOOPS_URL/?page=23
and have that instead result in an HTTP error, such as 404.

Is that correct?

Here are a few general observations.

While the link that is causing the issue is wrong, it is not technically an error. The custom error pages don't get called, as there is no HTTP error triggered. (The front page is found, and passed a query string it ignores.)

Something is creating the links that google follows. Until you find a correct that, there will still be a problem somewhere. Has anything been updated recently? As an example, I saw a module before with a XoopsPageNav error that generated links that looked a lot like this.

Goffy's suggestion about the search console sounded worthwhile.

Seeing the referrer for one of these problem URLs would pinpoint the actual source of the problem.

As a temporary solution, you could patch the XOOPS_ROOT_PATH/index.php

Adding this code on the next line after the opening "
if (!empty($_GET)) {
    if (!empty(
$_SERVER['HTTP_REFERER'])) {
        @
file_put_contents(__DIR__ '/queryurllog.txt'$_SERVER['HTTP_REFERER'] . "n"FILE_APPEND);
    }
    
http_response_code(404);
    exit;
}

Login

Who's Online

249 user(s) are online (140 user(s) are browsing Support Forums)


Members: 0


Guests: 249


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits