Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [htaccess] - nie dziala przekierowanie
terabit
post
Post #1





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


Witam

mam taki kod:
  1. RewriteEngine on
  2. RewriteRule ^strona/([^/.]+)/?$ index.php?strona=$1 [L]
  3. RewriteRule ^/([^/.]+)/?$ index.php?strona=$1 [L]


problem w tym że nie działa i nie mam pojęcia dlaczego
może coś jest z nim nie tak?

z gory dzieki za pomoc (IMG:style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 12)
skowron-line
post
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


Powinno być chyba [L,R] ale głoowy nie dam sobie obciąć.
Go to the top of the page
+Quote Post
terabit
post
Post #3





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


niestety nic nie pomoglo

  1. RewriteEngine on
  2. RewriteRule ^/([^/.]+)/?$ profil.php?l=$1 [L,R]
Go to the top of the page
+Quote Post
krzysztof_kf
post
Post #4





Grupa: Zarejestrowani
Postów: 1 135
Pomógł: 158
Dołączył: 19.03.2009
Skąd: Toruń

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


Do czego chcesz przekierowanie do folderu do podstrony ?
Go to the top of the page
+Quote Post
terabit
post
Post #5





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


dokladnie to z
strona.com/profil.php?l=wartosc
na
strona.com/wartosc
Go to the top of the page
+Quote Post
jaslanin
post
Post #6





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


Kod
RewriteEngine On
RewriteCond %{QUERY_STRING} ^l=(.+)
RewriteRule ^profil.php(.*)$ %1/? [L,R=301]


Ten post edytował jaslanin 26.05.2010, 21:50:25
Go to the top of the page
+Quote Post
terabit
post
Post #7





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


Cytat(jaslanin @ 26.05.2010, 19:40:15 ) *
Kod
RewriteCond %{QUERY_STRING} ^l=(.+)
RewriteRule ^profil.php(.*)$ %1/? [L,R=301]


nie działa :/

jak wpisze normalnie z profil.php?l=cossss to dziala a jak samo cossss to:
Not Found
The requested URL /cossss was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Go to the top of the page
+Quote Post
mayu11
post
Post #8





Grupa: Zarejestrowani
Postów: 99
Pomógł: 9
Dołączył: 9.09.2008

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


Kod
Options FollowSymLinks
RewriteEngine On
RewriteRule ^([^-]+)$ profil.php?l=$1 [L]
Go to the top of the page
+Quote Post
terabit
post
Post #9





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


Cytat(mayu11 @ 26.05.2010, 22:27:26 ) *
Kod
Options FollowSymLinks
RewriteEngine On
RewriteRule ^([^-]+)$ profil.php?l=$1 [L]


teraz wszedzie wyswietla ze taki profil nie istnieje, nawet na index.php
Go to the top of the page
+Quote Post
jaslanin
post
Post #10





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


1. Ustalmy najpierw co chcesz osiągnąć, ja zrozumiałem że dokładnie to:

Cytat(terabit @ 26.05.2010, 19:14:39 ) *
dokladnie to z
strona.com/profil.php?l=wartosc
na
strona.com/wartosc


2. Testujesz swój skrypt rzeczywiście w taki sposób: domena.pl/profil.php?l=wartosc, a nie np. domena.pl/podfolder/profil.php?l=wartosc


Cytat(terabit @ 26.05.2010, 19:56:37 ) *
nie działa :/

jak wpisze normalnie z profil.php?l=cossss to dziala a jak samo cossss to:
Not Found
The requested URL /cossss was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


3. W moim przykładzie ma to działać tak:

strona.com/profil.php?l=wartosc
przekierowuje na:
strona.com/wartosc

więc siłą rzeczy plik/folder strona.com/wartosc musi istnieć, chyba że w pliku htaccess masz jakieś inne reguły które coś zmieniają.

Ten post edytował jaslanin 27.05.2010, 10:48:26
Go to the top of the page
+Quote Post
terabit
post
Post #11





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


Cytat(jaslanin @ 27.05.2010, 11:44:37 ) *
2. Testujesz swój skrypt rzeczywiście w taki sposób: domena.pl/profil.php?l=wartosc, a nie np. domena.pl/podfolder/profil.php?l=wartosc

dokładnie tak jak powinno

Cytat(jaslanin @ 27.05.2010, 11:44:37 ) *
3. W moim przykładzie ma to działać tak:

strona.com/profil.php?l=wartosc
przekierowuje na:
strona.com/wartosc

więc siłą rzeczy plik/folder strona.com/wartosc musi istnieć, chyba że w pliku htaccess masz jakieś inne reguły które coś zmieniają.


możliwe że źle to wyjaśniłem

normalnie strona działa tak -
strona.com/profil.php?l=wartosc

ale chce skrócić adres by wyglądał tak:
strona.com/wartosc

z tym że nie ma zadnego folderu o nazwie "wartosc"...

poprostu gdy ktos wpisze strona.com/wartosc skrypt ma działać tak gdyby było wpisane strona.com/profil.php?l=wartosc
Go to the top of the page
+Quote Post
jaslanin
post
Post #12





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


Spróbuj tak:

Kod
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* profil.php?l=$0 [PT,L]
Go to the top of the page
+Quote Post
terabit
post
Post #13





Grupa: Zarejestrowani
Postów: 170
Pomógł: 4
Dołączył: 11.08.2006

Ostrzeżenie: (10%)
X----


Cytat(jaslanin @ 27.05.2010, 12:57:31 ) *
Spróbuj tak:

Kod
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* profil.php?l=$0 [PT,L]


wielkie dzięki, działa !
Go to the top of the page
+Quote Post

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: 25.12.2025 - 10:18