Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mod_rewrite] Działa i nie działa..., Historia wybiurczego działania mod_rewrite
Shendu
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 31.07.2006

Ostrzeżenie: (0%)
-----


Witam wszystkich.

Mam mały problem z modem rewrite.

Zaczne od wklejenia zawartości pliku .htaccess

taki jaki chciałbym żeby był:
Kod
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule wpis-b([0-9]*).html /?b=$1 [L]
RewriteRule archiwum/([0-9]*-[0-9]*) /?id=wyswietl_arch&arch=$1 [L]    <-ta deklaracja!!!!!!!!!!!


przykładowy link:
www.sse.net/archiwum/2006-11

taki jaki działa:
Kod
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule wpis-b([0-9]*).html /?b=$1 [L]
RewriteRule archiwum_([0-9]*-[0-9]*) /?id=wyswietl_arch&arch=$1 [L]    <-ta deklaracja!!!!!!!!!!!


przykładowy link:
www.sse.net/archiwum_2006-11


I już przechodze do sedna sprawy. Czemu mod działa z "_" a nie chce działać z "/".
Dokładnie chodzi o to ze strona funkcjoinuje w 100% sprawnie dla "_" a dla znaku "/" wywala mi sie i pokazuje błąd:
Kod
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 52

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 55

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 66

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 66

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 66

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 66

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/users/shendu/public_html/sse/archiwum_funkcje.php on line 66


za pomoc z góry dziękuje.

Ten post edytował Shendu 11.12.2006, 21:36:24
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
tomekp
post
Post #2





Grupa: Zarejestrowani
Postów: 171
Pomógł: 0
Dołączył: 17.12.2003
Skąd: Krakół

Ostrzeżenie: (0%)
-----


A powiedz mi mój drogi kolego co mówią w tej sytuacji logi apache.


--------------------
escape from the execution is futile.
Go to the top of the page
+Quote Post
envp
post
Post #3





Grupa: Zarejestrowani
Postów: 359
Pomógł: 1
Dołączył: 16.04.2006
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Mod rewrite:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

potem w index.php

  1. <?php
  2. ...
  3. $this->_sURI = substr($_SERVER['REQUEST_URI'],strlen($_SERVER['SCRIPT_NAME'])-9,strlen($_SERVER['REQUEST_URI']));
  4.  
  5. if (strstr($this->_sURI, '?')) {
  6. $this->_sURI = substr($this->_sURI, 0, strpos($this->_sURI, '?'));
  7. }
  8. $this->_aParams = explode('/', trim($this->_sURI, '/'));
  9. }
  10. ...
  11. ?>

i potem masz w _aParams[0] pierwszy argument ... itd
Go to the top of the page
+Quote Post
Shendu
post
Post #4





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 31.07.2006

Ostrzeżenie: (0%)
-----


w logach apacha powtarza sie jedna linijka error_log

Kod
[Thu Dec 14 15:42:24 2006] [notice] Apache/2.3.3 (Unix) php/5.1.6 configured -- resuming normal operations


envp ale po co tak robić skoro powinno działać z modu rewrite... Zreszta skrypt poprawnie działa na serwerz tylko nie wiem co jest u mnie na localu nie tak ze to nie działa

Ten post edytował Shendu 14.12.2006, 14:46:04
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 23:09