Ho un sito statico contenuto nella cartella "xxx". Dentro questa cartella c'è questo htaccess:
codice:ErrorDocument 404 /xxx/404.php
Che funziona alla meraviglia.
Il problema sorge quando digito www.nomesito.it/qualcosachenonesiste
Per risolvere ho creato un secondo htaccess con questo codice:
codice:ErrorDocument 404 /xxx/404.php
che funziona ma mi carica la pagina 404.php senza immagini e css.
Se scrivo:
codice:ErrorDocument 404 /404.php
e nel secondo file 404.php scrivo questo codice:
codice:<?php header ( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header ( "Cache-Control: no-cache" ); header ( "Pragma: no-cache" ); ?> <!DOCTYPE html> <html lang="it"> <head> <script type="text/javascript"> /*<![CDATA[*/ if (navigator.userLanguage) { var theAgent = navigator.userLanguage; } else { var theAgent = navigator.language; } if (theAgent.indexOf('it') != -1) { location.href = "xxx/404.php"; } else { location.href = "xxx/404.php"; } /*]]>*/ </script> </head> <body> </body> </html>
Il browser imparrisce e vengo rediretto a www.nomesito.it/xxx/xxx/.../xxx/... Il ciclo se protratto credo che faccia bloccare il browser.
Perché accade questo? Come posso risolvere?
Grazie

Rispondi quotando