| Autor | Zpráva | ||
|---|---|---|---|
| kozuch Profil |
Dobry den,
na webe som zacal pouzivat .htacces. Na FTP-cku funguje, ale na localhoste nie. Najprv som myslel, ze to je wampom, ale potom som skusal aj na xamppe a nic. Presiel som uz vsetky fora (aj anglikce) a nic som nenasiel. Mod_rewrite mam zapnuty. Ide o to, ze ked spustim web na localhoste tak ho normalne zobrazi, ale akonahle kliknem na nejaky odkaz, link, kde mam pouzity htacces hodi ma to na defaultnu screen localhostu. Moj htacces vyzera takto. RewriteEngine on RewriteBase / RewriteRule ^meno$ index.php?include=meno.php RewriteRule ^nazov$ index.php?include=nazov.php RewriteRule ^skuska$ index.php?include=skuska.php Dakujem za rady. |
||
| Kajman Profil |
#2 · Zasláno: 4. 4. 2013, 11:10:44
Když si zadáte do prohlížeče na localhostu přímo adresu index.php?include=meno.php tak funguje korektně?
|
||
| kozuch Profil |
Kajman:
Ano, vtedy funguje korektne. |
||
| Kajman Profil |
#4 · Zasláno: 4. 4. 2013, 11:33:30
Zkuste si zapnout v konfiguraci apache RewriteLog a mrkněte do něj, co se tam děje.
|
||
| kozuch Profil |
#5 · Zasláno: 4. 4. 2013, 12:01:49
pise nieco taketo, ja sa v tom ale vobec nevyznam:
127.0.0.1 - - [04/Apr/2013:11:58:10 +0200] [localhost/sid#aef840][rid#1940290/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/pondelok -> pondelok 127.0.0.1 - - [04/Apr/2013:11:58:10 +0200] [localhost/sid#aef840][rid#1940290/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^obsah$' to uri 'pondelok' a takto pokracuje este dalej, malo to asi 300 riadok. Dal som tam level 5. |
||
| Kajman Profil |
#6 · Zasláno: 4. 4. 2013, 12:27:23
|
||
| kozuch Profil |
#7 · Zasláno: 4. 4. 2013, 12:43:56 · Upravil/a: kozuch
Prepisujem, len som tu nechcel vypisovat cely kod... a este raz, na FTP to funguje.
A ked tam zadam nieco, co naozaj nemam zadefinovane, napise "Page not found" a nepresmeruje ma na defaultnu obrazovku localhostu. |
||
| Kajman Profil |
Ta tři uvedená pravila se dají zapsat jedním
RewriteRule ^(meno|nazov|skuska)$ index.php?include=$1.php [L,QSA] Když si optimalizujete počet pravidel, možná se sem již vejde celý .htaccess a třeba bude už i přehlednější log přepisování a zádrhel tam objevíte. Také si můžete porovnat phpinfo(); |
||
| kozuch Profil |
#9 · Zasláno: 4. 4. 2013, 14:38:16
Tak toto je momentalne cely rewrtite log:
127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/obsah -> obsah 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'obsah' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (2) [perdir D:/wamp/www/mojweb/] rewrite 'obsah' -> 'index.php?include=obsah.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (3) split uri=index.php?include=obsah.php -> uri=index.php, args=include=obsah.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (3) [perdir D:/wamp/www/mojweb/] add per-dir prefix: index.php -> D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (2) [perdir D:/wamp/www/mojweb/] trying to replace prefix D:/wamp/www/mojweb/ with / 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (5) strip matching prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (4) add subst prefix: index.php -> /index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19982c0/initial] (1) [perdir D:/wamp/www/mojweb/] internal redirect with /index.php [INTERNAL REDIRECT] 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19942a0/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19942a0/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19942a0/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#1934230/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#1934230/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#1934230/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19d5290/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19d5290/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19d5290/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19a6330/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#18f51f0/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19a6330/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#18f51f0/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19a6330/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#18f51f0/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19ac360/initial] (3) [perdir D:/wamp/www/mojweb/] strip per-dir prefix: D:/wamp/www/mojweb/index.php -> index.php 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19ac360/initial] (3) [perdir D:/wamp/www/mojweb/] applying pattern '^(voda|deficit|obsah)$' to uri 'index.php' 127.0.0.1 - - [04/Apr/2013:14:36:37 +0200] [localhost/sid#aef840][rid#19ac360/initial] (1) [perdir D:/wamp/www/mojweb/] pass through D:/wamp/www/mojweb/index.php |
||
| Davex Profil |
Pokud je web na localhostu v podadresáři, tak se musí také odpovídajícím způsobem změnit
RewriteBase /mojweb/ |
||
| kozuch Profil |
#11 · Zasláno: 5. 4. 2013, 11:03:41
Ano, uz som na to dosiel. Vdaka, za pomoc.
|
||
|
Časová prodleva: 13 let
|
|||
0