url rewrite
David Česal
David na Cesal.cz
Čtvrtek Říjen 8 05:38:44 CEST 2009
Asi jsem měl poslat celý .htaccess, tak to napravím.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$
RewriteRule ^(.+[^/])$ /$1/ [R=301]
RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$
RewriteRule ^(.+[^/])$ /$1/ [R=301]
# Parametry
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/([^/]+)/$
RewriteRule .* /index.php?p=%1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/$
RewriteRule .* /index.php?p=%1&p2=%2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/([^/]+)/$
RewriteRule .* /index.php?p=%1&p2=%2&p3=%3 [L,QSA]
Ještě doplním, že http://web.cz/zbozi/1234/ pak budou v $_GET["p"]="zbozi",
$_GET["p2"]="1234" atd.
DC
-----Original Message-----
From: linux-bounces na linux.cz [mailto:linux-bounces na linux.cz] On Behalf Of
Tomáš Koželuh
Sent: Wednesday, October 07, 2009 11:57 PM
To: 'Diskuse o Linuxu v cestine'
Subject: RE: url rewrite
V podstatě jsem zkusil tohle:
RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/$
RewriteRule .* /index.php?p=%1&p2=%2 [L,QSA]
http://web.cz/zbozi/1234/
Apache v tu chvíli zahlásí, že adresář zbozi neexistuje. Já vím, že
neexistuje, ale přes rewrite mu potřebuju říct, aby ho ten adresář přestal
zajímat a byl pouze v odkazu.
> -----Original Message-----
> From: linux-bounces na linux.cz [mailto:linux-bounces na linux.cz] On Behalf
> Of David Česal
> Sent: Wednesday, October 07, 2009 8:12 PM
>
> Zdravím,
> já mám v .htaccess toto:
>
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_URI} ^/([^/]+)/$
> RewriteRule .* /index.php?p=%1 [L,QSA]
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/$
> RewriteRule .* /index.php?p=%1&p2=%2 [L,QSA]
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/([^/]+)/$
> RewriteRule .* /index.php?p=%1&p2=%2&p3=%3 [L,QSA]
>
> Mohl bych pak použít http://web.cz/zbozi/pocitac/hp/ a v promennych
> bych mel
> $p=zbozi, $p2=pocitac, $p3=hp.
_______________________________________________
Linux mailing list
Linux na linux.cz
http://www.linux.cz/mailman/listinfo/linux
Další informace o konferenci Linux