Home Forum
2024-12-22
Benvenuto, Ospite
Nome Utente Password: Ricordami

Redirect Item only if 404 occurs
(1 Online) (1) Ospite
  • Pagina:
  • 1

ARGOMENTO: Redirect Item only if 404 occurs

Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #531

  • Galli
  • Offline
  • Fresh Boarder
  • Messaggi: 4
I would like to redirect all links under a subdirectory to the same location but only if the link gives a 404 error. Currently I cant seem to figure out how to do that. I have setup an item for the directory but when I enable it ever link under that directory redirects regardless if there is a 404 error or not.

Is there a way to control this? I am running .htaccess and sh404

Thanks
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #533

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
With ReDJ you can redirect all URLs that match a certain regexp pattern to a single destination URL.

Unfortunately, you want to do this only if a 404 error happpens, and this is not possible at the moment without modify the code. You should change redj.php in plugins\system folder. For example, you can force to exit without apply redirect if there aren't errors. This can be done adding this row after line 93:

if (JError::isError($object) == false) return;


But in this way you can't do a redirect without an error.

This can be a good new feature to implement in the next release.

Regards,
Luigi
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #534

  • Galli
  • Offline
  • Fresh Boarder
  • Messaggi: 4
Thank you for the reply. That is great because I am really trying to solve errors created by old pages and I don't want my pagerank to be negatively impacted so I will only redirect errors.

If you were to implement this in the next version you might want to think about having the item itself drive this (since other peoples requirements might be different). For instance each item entry could have a selection to either always redirect or only on error.

Thanks,
River
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #535

  • Galli
  • Offline
  • Fresh Boarder
  • Messaggi: 4
After adding this row no errors are not even getting redirected. I think it is probably because these 404 errors are getting returned by sh404SEF. Is there something else I can add to this file that will work?
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #536

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
This is exactly how I'm thinking to made it.

Thanks for idea,
Luigi
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #537

  • Galli
  • Offline
  • Fresh Boarder
  • Messaggi: 4
When I implemented the changed you suggested then none of my redirects were working for errors generated from sh404SEF. Is there a way to address this in the code?
L'Argomento è stato bloccato.

Re:Redirect Item only if 404 occurs 15 Anni, 3 Mesi fa #538

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Just try to change plugin order, putting ReDJ plugin before (lowest number) sh404SEF one. Order is important because Joomla execute plugin using specified order.

Otherwise, you should try to configure sh404SEF to do nothing on your error pages.

Please, let me know.

Luigi
L'Argomento è stato bloccato.
  • Pagina:
  • 1
Moderatori: admin
Tempo generazione pagina: 0.42 secondi
Cerca con Google
News
Chi è online
 135 visitatori online
Sponsor

slotmachineaamsonline.com è una guida alle migliori slot machine online legali in Italia. Sul sito trovi un elenco sempre aggiornato dei casino online con Slot machine e bonus slot, le ultime novità dal mondo delle slot online e le migliori strategie per vincere. Inoltre, è disponibile una sezione dedicata alle slot machine da BAR che finalmente sono disponibili nella versione online.