Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Skracanie adresu
Onliner
post
Post #1





Grupa: Zarejestrowani
Postów: 88
Pomógł: 2
Dołączył: 1.10.2006
Skąd: Tczew

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


Witam!
Czy ktos z was wie jak zrobic skrocony adres strony z poziomu php(nie CPANEL).
Np. zamiast:
www.adresstrony.pl/s.php?id=jankowalski
to
www.jankowalski.adresstrony.pl, lub www.adresstrony.pl/jankowalski
Z góry dziękuję
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
MMX3
post
Post #2





Grupa: Zarejestrowani
Postów: 155
Pomógł: 9
Dołączył: 26.01.2004
Skąd: Poznań

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


modrewrite się nazywa np:

  1. <?php
  2. RewriteEngine on
  3. //seo
  4. RewriteCond %{HTTP_HOST} ^yourblog.com
  5. RewriteRule (.*)http://www.yourblog.com/$ [R=301,L] 
  6. //blokowanie katalogow i plikow
  7. RewriteRule ^(css|js|lib|inc|img) - [L]
  8. RewriteRule ^(index.php) - [L]
  9. //resta przekierowywana do php
  10. RewriteRule ^.*$ index.php
  11. ?>


można to zrobić inaczej tak, że apache będzie preg'iem sprawdzał parametry itp.

np.
  1. <?php
  2. RewriteEngine on
  3. RewriteRule ^/wesele$ /wesele/index.php 
  4. RewriteRule ^([a-zA-Z]+)/?$ /wesele/index.php?owner=$1 
  5. RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/?$ /wesele/index.php?owner=$1&go=$2
  6. RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)/?$ /wesele/index.php?owner=$1&go=$2&id=$3
  7. RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)/([0-9]+)/?$ /wesele/index.php?owner=$1&go=$2&id=$3&img=$4
  8. ?>


Zapraszam na google w celu pogłębienia wiedzy

Ten post edytował MMX3 28.10.2007, 13:51:18
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: 7.10.2025 - 14:07