Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> mod_rewrite - pomoc, zastąpić wiele linii
grzegorz_g
post
Post #1





Grupa: Zarejestrowani
Postów: 259
Pomógł: 0
Dołączył: 26.10.2004

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


dopiero co raczkuję w mod_rewrite , ale działa mi taki plik .htaccess:
  1. <?php
  2.  
  3. RewriteEngine On
  4.  
  5. RewriteRule ^([0-9]+),tabela.html$ index.php?page=tabela&show=$1 [L]
  6. RewriteRule ^([0-9]+),skarb.html$ index.php?page=skarb_info&id=$1 [L]
  7. RewriteRule ^([0-9]+)/kolejka([0-9]+).html$ index.php?page=tabela&show=$1&zmienna=$2 [L]
  8.  
  9.  
  10. RewriteRule ^klasa_a/kolejka([0-9]+).html$ index.php?page=tabela&show=1&zmienna=$1 [L]
  11.  
  12. ?>


Mam teraz pytanie do ekspertów w tej dziedzinie czy ten zapis nie wymaga jakiś
dodatkowych opcji , zabezpieczeń itp.
Mam też pytanie dotyczące ostatniej linii
  1. <?php
  2.  
  3. RewriteRule ^klasa_a/kolejka([0-9]+).html$ index.php?page=tabela&show=1&zmienna=$1 [L]
  4.  
  5. ?>


w swoim skrypcie mam jeszcze klika klas rozgrywkowych(15), i czy taka forma jest najbardziej efektywna:
  1. <?php
  2.  
  3. RewriteRule ^klasa_a/kolejka([0-9]+).html$ index.php?page=tabela&show=1&zmienna=$1 [L]
  4. RewriteRule ^klasa_b/kolejka([0-9]+).html$ index.php?page=tabela&show=2&zmienna=$1 [L]
  5. RewriteRule ^klasa_c/kolejka([0-9]+).html$ index.php?page=tabela&show=3&zmienna=$1 [L]
  6. RewriteRule ^klasa_d/kolejka([0-9]+).html$ index.php?page=tabela&show=4&zmienna=$1 [L]
  7. RewriteRule ^klasa_e/kolejka([0-9]+).html$ index.php?page=tabela&show=5&zmienna=$1 [L]
  8. RewriteRule ^klasa_f/kolejka([0-9]+).html$ index.php?page=tabela&show=6&zmienna=$1 [L]
  9. RewriteRule ^klasa_g/kolejka([0-9]+).html$ index.php?page=tabela&show=7&zmienna=$1 [L]
  10.  
  11. itd ...
  12.  
  13. ?>


z góry dziękuję za wszelką pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
hwao
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Cytat(grzegorz_g @ 2005-05-09 18:56:10)
  1. <?php
  2. RewriteRule ^klasa_a/kolejka([0-9]+).html$ index.php?page=tabela&show=1&zmienna= [L]
  3. RewriteRule ^klasa_b/kolejka([0-9]+).html$ index.php?page=tabela&show=2&zmienna= [L]
  4. RewriteRule ^klasa_c/kolejka([0-9]+).html$ index.php?page=tabela&show=3&zmienna= [L]
  5. RewriteRule ^klasa_d/kolejka([0-9]+).html$ index.php?page=tabela&show=4&zmienna= [L]
  6. RewriteRule ^klasa_e/kolejka([0-9]+).html$ 
  7. ?>

Mi to troche wyglada na zle zaplanowana aplikacje (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ale ...

Mozna to rozwiazac
Kod
RewriteRule ^klasa_([a-z]+)/kolejka([0-9]+).html$[L]

Potem w php tablica z kluczami i kluczem jest GET a wartosc dopasowana do niego i jedziesz z bazy danych co trzeba.

Takie urle to wg mnie zle przemyslana aplikacja (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) dlatego sa takie a nie inne.

Ale jezeli to niczemu nie przeszkadza to czemu takich nie zostawic... (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 3.10.2025 - 16:58