![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 0 Dołączył: 2.12.2014 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
mam dwa uklady stron: http://strona.pl/krzesla.html http://strona.pl/krzesla.html?strona=5 w htaccess musze zrobic zeby wszystko kierowalo na index.php, wyciagalo kategorie i numer podstrony jesli jest, wiec mam: Kod RewriteEngine on DirectoryIndex index.php RewriteCond $1 !^(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteRule ^([a-zA-Z0-9]+).html?page=([0-9]+)$ index.php?kategoria=$1&page=$2 RewriteRule ^([a-zA-Z0-9]+).html$ index.php?kategoria=$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA] teraz jak wchodze na http://strona.pl/krzesla.html oraz jak wchodze na http://strona.pl/krzesla.html?strona=5 jest to samo: Kod Array ( [kategoria] => krzesla ) Ale jak zakomentuje linijke: Kod RewriteRule ^([a-zA-Z0-9]+).html$ index.php?kategoria=$1 w stronie http://strona.pl/krzesla.html gdy wyswietlam $_GET mam: Kod Array ( [/krzesla_html] => ) na stronie http://strona.pl/krzesla.html?strona=5 dane $_GET zawieraja: Kod Array ( [/krzesla_html] => [page] => 5 ) nie mam zielonego pojecia dla czego nie pobiera prawidlowo kategorii. Prosze o jakas podpowiedz chociaz co zle tutaj robie ... |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 4 291 Pomógł: 829 Dołączył: 14.02.2009 Skąd: łódź Ostrzeżenie: (0%) ![]() ![]() |
Kod RewriteRule ^([a-zA-Z0-9]+).html$ index.php?kategoria=$1 Wymuszasz tutaj, że adres może zawierać tylko jeden parametr Nospor napisał fajny kod dla ładnych urli http://nospor.pl/ladne-urle.html |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 0 Dołączył: 2.12.2014 Ostrzeżenie: (0%) ![]() ![]() |
@Turson, ok rozumiem. Ale jak usunę ta linijke tez źle działa. Zamiast kategoria=krzesla pobiera mi sie:
jesli jest tylko linijka:
i tego kompletnie nie rozumiem :/ |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 6 807 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Kod RewriteEngine on DirectoryIndex index.php RewriteCond %{REQUEST_URI} !^/(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]+).html$ RewriteCond %{QUERY_STRING} page=([0-9]+)$ RewriteRule .* index.php?kategoria=$2&page=$3 RewriteCond %{REQUEST_URI} !^/(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]+).html$ RewriteRule .* index.php?kategoria=$2 |
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 0 Dołączył: 2.12.2014 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#6
|
|
Grupa: Zarejestrowani Postów: 6 807 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Kod RewriteEngine on
DirectoryIndex index.php RewriteCond %{REQUEST_URI} !^/(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]+).html$ RewriteCond %{QUERY_STRING} strona=([0-9]+)$ RewriteRule .* index.php?kategoria=%1&page=%2 RewriteCond %{REQUEST_URI} !^/(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]+).html$ RewriteRule .* index.php?kategoria=%1 |
|
|
![]()
Post
#7
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 0 Dołączył: 2.12.2014 Ostrzeżenie: (0%) ![]() ![]() |
@trueblue dziękuję Ci bardzo za pomoc, ta druga część instrukcji działa prawidłowo, pobiera kategorie, jednak pierwsza nadal nie łapie parametru strona (IMG:style_emoticons/default/sad.gif) niby wszystko wyglada dobrze ale nie dziala :/ w obu przypadkach mam:
|
|
|
![]()
Post
#8
|
|
Grupa: Zarejestrowani Postów: 6 807 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Jak wygląda link w przypadku parametru ze stroną?
|
|
|
![]()
Post
#9
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 0 Dołączył: 2.12.2014 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#10
|
|
Grupa: Zarejestrowani Postów: 6 807 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Niepotrzebnie skomplikowałem:
Kod RewriteEngine on
DirectoryIndex index.php RewriteCond %{REQUEST_URI} !^/(index\.php|templatka|sitemap\.xml\.gz|robots\.txt|google*\.html) RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]+).html RewriteRule .* index.php?kategoria=%1 [QSA] Ten post edytował trueblue 8.04.2015, 11:13:01 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 11.10.2025 - 22:32 |