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]
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" );
}
{
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: neverwinter_nights_2.html" );
}