Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Redirect 301
Orish
post
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 11.11.2007

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


Witam.

Mam problem z redirect 301. Chodzi o zmianę adresu podstron. W pliku .htaccess mam ustawiony mod rewrite, np.:

Kod
RewriteRule ^neverwinter_nights_2.html$ index.php?doc=neverwinter_nights_2&menu=nwn2 [L]

Zależy mi jednak, aby dodatkowo zrobić przekierowanie 301 ze względu na pozycję w Google. Próbowałem to już zrobić w .htaccess, ale chyba coś zmaściłem, bo nie działa:

Kod
RewriteCond %{QUERY_STRING} ^ index.php?doc=neverwinter_nights_2&menu=nwn2$ [NC]
RewriteRule ^(.*)$ http://www.insimilion.pl/neverwinter_nights_2.html [R=301,L]

Próbowałem też w PHP, lecz skrypt się zapętla i nie działa:

Kod
if ($_GET['doc'] == "neverwinter_nights_2")
{
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: neverwinter_nights_2.html" );
}


Ten post edytował Orish 28.02.2008, 12:34:56
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Kowalikus
post
Post #2





Grupa: Zarejestrowani
Postów: 111
Pomógł: 25
Dołączył: 23.07.2004

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


Spóbuj
  1. <?php
  2. if ($_SERVER['QUERY_STRING'] && $_GET['doc'] == "neverwinter_nights_2")
  3. {
  4.  
  5. Header( "Location: /neverwinter_nights_2.html", 301 );
  6. }
  7. ?>




Jeżeli Ci się zapętla to coś masz nie tak


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 20.08.2025 - 13:44