Redirect na index.php
 
mlavta114. sep 2008 12:05:14Pridružen od:
10. dec 2006
580 objav
#1Zanima me katera varijanta naj bi bila boljša, da redirectaš na index.php s pomočjo htaccessa ali kar s pomočjo.php fajla?
Ker imam majhen problem kako bi naredil s htaccess 404 error, ker mi vedno redirecta na index.php. Tudi če dam na začetek dajla.

Hvala in lp
 
sce14. sep 2008 13:42:36Pridružen od:
27. maj 2007
591 objav
#2Koda za 404 je v htaccess preprosta:ErrorDocument 404 /napake/404.htmlče pa hočeš imeti index.php namesto npr index.html uporabi spodaj:

Koda da ti index.php prvo prebere in nato index.htmlDirectoryIndex index.php index.html
Več:
http://www.htpasswdgenerator.com/apache/htaccess.html#15

če hočeš imeti index.php namesto npr index.html uporabi htaccess:

Koda da ti index.php prvo prebere in nato index.htmlDirectoryIndex index.php index.html
Več:
http://www.htpasswdgenerator.com/apache/htaccess.html#15
nazadnje urejal sce 14. sep 2008 13:44:40 (ureditev urljev)
 
mlavta114. sep 2008 13:48:18Pridružen od:
10. dec 2006
580 objav
#3Ja, to kodo poznam, samo jaz imam tako:

ErrorDocument 404 /error.php

AddDefaultCharset UTF-8
RewriteEngine on


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^verzi.com
RewriteRule (.*) http://www.verzi.com/$1 [R=301,L]
</IfModule>


RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php


Pa ne dela...
 
Vini14. sep 2008 13:52:21Pridružen od:
1. sep 2006
3973 objav
#4Ce vse rewritas v index.php, potem nekako do 404 sploh ne pride, kajne? Zadevo bos moral resiti tako, da ugotovis znotraj index.php, ce naj bi dokument obstajal ali ne, in prikazal ali vsebino, ali pa 404 dokument.
Wicked! Witness the strength of wicked blogging!
 
mlavta114. sep 2008 14:19:28Pridružen od:
10. dec 2006
580 objav
#5Aha, tako. Hvala Vini. Kaj pa kakšni drugi načini?
 
bl4ckb1rd14. sep 2008 15:13:12Pridružen od:
18. avg 2008
453 objav
#6Jah tko da če ti baza vrne da je poizvedba mysql_num_rows = 0, pol fizično redirectaš s header("Location: 404.html"); ... druge varjante skor nimaš pri takem rewrite-ju.
Spletna trgovina
 
mlavta114. sep 2008 15:17:14Pridružen od:
10. dec 2006
580 objav
#7Ne, sej sm mislu če je še kešna varijanta z drugačnmu rewritom.
Samo da je isti učinek...
nazadnje urejal mlavta1 14. sep 2008 15:17:28
 
Roky14. sep 2008 17:00:31Pridružen od:
9. apr 2008
291 objav
#8Preveri v index.php če mysql_num_rows = 0 kot pravi blackbird in potem vrni 404 header

header('HTTP/1.1 404 Not Found');
$smarty->display('page_not_found.tpl');
exit;
http://trsplet.com/blog/ - Blog o spletnih tehnologijah
 
stran 1 od 1 |<<1>>|