WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => Modules => Topic started by: astricia on June 18, 2019, 07:59:26 AM

Title: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 07:59:26 AM
Hi all (esp. Ruud),

I am trying out the 404 module (1.3.1) for the first time for a project that used to be a static html page (with a long google history) and is now transferred into WebsiteBaker. Since the client was worried about his google links going to wrong places, I looked into this module.

It works fine on the first level. But any subpage on the 2nd level, redirects to a completely different page and not what I put in.

I also noticed that instead of a tree of PAGES to select from, I get a tree of all SECTIONS to select from. Since every page consists of 4 or 5 sections, this makes it very difficult to find the correct link.

Is this a bug or am I doing anything wrong?

Thanks,
Astrid
Title: Re: 404 module redirects to wrong pages...
Post by: dbs on June 18, 2019, 08:20:51 AM
Hi, ja, alle Sections werden gleichrangig dargestellt (nicht übersichtlich).
Und deine Liste wird nacheinander abgearbeitet. Der erste Treffer leitet also um. Da geht es um Genauigkeit.

---

Hi, yes, all sections are displayed equal (not clearly arranged).
And your list will be processed one after the other. So the first hit redirects. It's all about accuracy.
Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 08:28:13 AM
Hmmm... also ich habe in den Regeln bei Error URL die genaue URL eingegeben, nicht nur irgendeinen Teil davon. Und umgeleitet wird aber auf eine komplett andere (Unter-)Seite. Wenn ich einen anderen Abschnitt der (richtigen) Unterseite auswähle, geht er wieder auf eine andere (falsche) Unterseite. Die Logik erschließt sich mir nicht. Was muss ich denn machen, dass auch bei Unterseiten korrekt weitergeleitet wird?
Title: Re: 404 module redirects to wrong pages...
Post by: dbs on June 18, 2019, 09:32:56 AM
Falsche URL: https://doamin.de/pages/aaaa.php

Error URL          Umleitungsseite
/aaaa.php   ->   Auswahl aus Dropdown
Das wäre ziemlich genau.

Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 10:33:26 AM
Habe ich genauso.

Seitenbaum (grob verkleinert):
/a
/a/1
/a/2
/a/3
/b
/b/1
/b/2
/b/3
/c

Falsche URL: https://domain.de/dasistunterseiteb3.htm

ERROR URL                        Umleitungsseite
dasistunterseiteb3. htm     Erste Section /b/3

Es leitet aber zu /a/2 weiter. Und wenn ich eine andere Section von b/3 auswähle, dann leitet es zu a/3 weiter.

Ich habe übrigens auch Shorturl installiert. Weiß nicht, ob das da mit reinspielt... ?

Es klappt reibungslos bei den Oberseiten /a und /b - die leiten korrekt weiter. Aber nicht die Unterseiten.
Title: Re: 404 module redirects to wrong pages...
Post by: dbs on June 18, 2019, 11:26:10 AM
/a/1 wird schon bei
/a    gefunden und umgeleitet

also besser erst /a/1 ganz oben auflisten.
Wahrscheinlich einfacher das in der htaccess zu machen.
Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 11:53:13 AM
Daran liegt es definitiv nicht. Selbst wenn ich die Unterseite ganz oben als erstes anlege, leitet sie zu einer falschen Unterseite weiter.

Die Unterseite b/3 hat 6 Sections. Nehme ich die erste Section, leitet sie zu a/15 weiter. Bei der zweiten zu a/4, bei der dritten zu a/8 usw. - immer eine andere, und immer eine falsche! Dabei gibt es (bislang) keine einzige direkte Umleitung zu irgendeiner Section von a/15, a/4 oder a/8. Bislang habe ich 4 Umleitungen angelegt, die anderen drei sind alle von der ersten Ebene, als /a, /b und /c - und die leiten auch alle korrekt weiter.
Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 12:24:35 PM
Um das mal zu verdeutlichen, hier zwei Screenshots.

Zeile 1 und 5 sind Unterseiten, Zeile 2 bis 4 sind Oberseiten.

(https://www.bilder-upload.eu/upload/414bfe-1560853218.jpg)

Hier sieht man, wo diese Seiten hin verlinken. Bei Zeile 2 bis 4 ist alles OK. Bei Zeile 1 und 5-7 nicht. Bei den unteren drei Zeilen habe ich jeweils eine andere Section der entsprechenden Seite ausgewählt.

(https://www.bilder-upload.eu/upload/a69780-1560853257.jpg)
Title: Re: 404 module redirects to wrong pages...
Post by: dbs on June 18, 2019, 12:31:30 PM
Hm, sehr merkwürdig.
Benutze das Modul seit Jahren, macht was es soll.
Bei dir nicht.
Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 18, 2019, 12:34:20 PM
Ja, offensichtlich nicht. Deswegen frage ich ja.... :-/

Ruud, can you help???
Title: Re: 404 module redirects to wrong pages...
Post by: Ruud on June 19, 2019, 12:12:49 PM
I think it is a backend problem..
This line gave me the hint :-)
I also noticed that instead of a tree of PAGES to select from, I get a tree of all SECTIONS to select from. Since every page consists of 4 or 5 sections, this makes it very difficult to find the correct link.

I guess the 404 page also has another module that builds a page-list (section-list in this case) for some selection.
To prevent slow loading in large website, the pagelist is stored in a variable and if that variable exists it will be re-used.
The variable name is a little bit generic ($links), so it is possible another module uses that already.

Now, you select a section_id and this section_id is used as page_id to find the correct page.
Since section_id's are alway much higher than page_id's the result will be unpredictable.

I must admit, it is bad programming :-)
I will do a quickfix in a next version.
Title: Re: 404 module redirects to wrong pages...
Post by: astricia on June 19, 2019, 01:49:58 PM
Tested Ruud's fix - and it works perfectly! Yes, there was a section picker section on the same page - which probably used the $links variable for the sections instead of pages... Now it works perfectly! Thanks, Ruud!

Astrid :-)
Title: Re: 404 module redirects to wrong pages...
Post by: Ruud on June 19, 2019, 03:21:06 PM
The fixed version (1.4.1) is now available on my website:

https://dev4me.com/modules-snippets/opensource/404/