Archa Posted September 22, 2007 Report Share Posted September 22, 2007 (edited) Labdien, kā pasargāt folderi lai rādītos kad to atver no web browsera 404 - Not Found ?? zinu ka jāuzstaisa htaccess bet kas jaraksta iekšā 403,404,405.php?? Edited September 22, 2007 by Archa Link to comment Share on other sites More sharing options...
iall Posted September 22, 2007 Report Share Posted September 22, 2007 http://www.mightycoach.com/articles/htmltr.../custom404.html http://www.pageresource.com/zine/custom404.htm Ceru ,ka palīdzēs! :D Link to comment Share on other sites More sharing options...
andrisp Posted September 23, 2007 Report Share Posted September 23, 2007 Ja nemaldos, tad var arī vienkārši iemest iekš index.php failu ar <?php header("HTTP/1.0 404 Not Found"); die(); ?> Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2007 Report Share Posted September 23, 2007 Var, bet tad ja vērs /folderis/bilde.jpg, tad nebūs 404, ja tāds fails eksistēs. Link to comment Share on other sites More sharing options...
Toms Posted September 23, 2007 Report Share Posted September 23, 2007 "ja vērs /folderis/bilde.jpg, tad nebūs 404" A kā dabūt, lai ir 404 arī tad? Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2007 Report Share Posted September 23, 2007 Ar .htaccess failu. Link to comment Share on other sites More sharing options...
Toms Posted September 23, 2007 Report Share Posted September 23, 2007 <?php header("HTTP/1.0 404 Not Found"); die(); ?> Ja ir fails ar šādu saturu, tad kā panākt lai būtu tas 404? Pārlūkam tiek atgriezta atbilde 404, bet neparādās 404 lapa.. Ir vienkārši balts ekrāns. Ar htaccess taču neder, jo vienam lietotājam viņu jāuzrāda kā 404, bet otram nē (pēc attiecīgiem notikumiem). Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2007 Report Share Posted September 23, 2007 Ar htaccess taču neder, jo vienam lietotājam viņu jāuzrāda kā 404, bet otram nē (pēc attiecīgiem notikumiem). Autors neko tādu neprasīja. Ja vajag pēc attiecīģiem notikumiem, tad jālieto if nosacījums: if (a) { b } else { c }. Link to comment Share on other sites More sharing options...
Toms Posted September 23, 2007 Report Share Posted September 23, 2007 Nu es takš prasu... Un Tu joprojām nesaprati problēmu. Nosūtot pārlūkam 404, tas nedirektējas uz serverī uzstādīto 404 lapu. Tā vietā ir vienkārši tukša lapa. Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2007 Report Share Posted September 23, 2007 Es ļoti labi sapratu "problēmu". Tu nesaprati risinājumu. if (attiecīgais_notikums) { echo "viss ok"; } else { header("Location: sliktaa_juuzera_404_lapa.html"); die(); } Link to comment Share on other sites More sharing options...
Toms Posted September 23, 2007 Report Share Posted September 23, 2007 Nujā, biju domājis header("Location: sliktaa_juuzera_404_lapa.html"); vietā iztikt ar header("HTTP/1.0 404 Not Found"); un lai parādās sliktaa_juuzera_404_lapa.html Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2007 Report Share Posted September 23, 2007 404 statusa kods nozīmē, ka lapa dotajā adresē nav atrasta. Bet tu jau to negribi, tu gribi parādīt kautkādu citu lapu (kurai ir jābūt, tā nevar netikt atrasta). Link to comment Share on other sites More sharing options...
Toms Posted September 23, 2007 Report Share Posted September 23, 2007 Aha, sapratu. Link to comment Share on other sites More sharing options...
Archa Posted September 23, 2007 Author Report Share Posted September 23, 2007 (edited) ir iespējams uzlikt redirectu, lai atverot to folderi parādās 404 not found, bet tas folderis eksistē?? Piemērs kā es gribētu! http://bithack.lv/torrents/ Vai šāds kods derēs?? P.S šo es rakstu .htaccess failā un ieliku vinju root direkcija, tad izveidoju folderu ar nosaukumu error un ievietoju pliku 404.php failu!! Options +FollowSymLinks RewriteEngine On ErrorDocument 404 /error/404.php ErrorDocument 404 http://localhost/torrents/ Un tālak izveidojot .htaccess failu es vinju ielieku torrents folderī! Order allow,deny deny from all Edited September 23, 2007 by Archa Link to comment Share on other sites More sharing options...
Kavacky Posted September 23, 2007 Report Share Posted September 23, 2007 "ErrorDocument 404 /error/404.php ErrorDocument 404 http://localhost/torrents/" -> WTF LOL? Tieši tādu var dabūt ar echo '<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>404 - Not Found</title> </head> <body> <h1>404 - Not Found</h1> </body> </html>' Link to comment Share on other sites More sharing options...
Recommended Posts