PHP yönlendirmesi

PHP sayfadan URL'ye yönlendirme.PHP 301 yönlendirmesi.

Bu PHP yeniden yönlendirmesi, HTTP yanıt durum kodunu döndürmelidir: 301 Kalıcı Olarak Taşındı.

Arama motorları, sayfa sıralamasını eski URL'den yeni URL'ye aktarmak için 301 yanıt durum kodunu kullanır.

PHP başlık yönlendirmesi

old-page.php kodunu yeni-page.php'ye yönlendirme koduyla değiştirin.

eski sayfa.php:

<?php
// PHP permanent URL redirection
header("Location: http://www.domain.com/new-page.php", true, 301);
exit();
?>

Eski sayfa .php dosya uzantısına sahip olmalıdır.

Yeni sayfa herhangi bir uzantı ile olabilir.

PHP yönlendirme örnekleri

Örnek 1

php-yönlendirme-testi.php

<?php
// PHP permanent URL redirection test
header("Location: https://cmtoinchesconvert.com/tr/web/dev/php-redirect.html", true, 301);
exit();
?>

 

php-redirect-test.php'den tekrar bu sayfaya yönlendirmek için bu bağlantıya basın:

 

PHP yönlendirme testi - PHP dosyası

Örnek 2

php-redirect-test.htm

<?php
// PHP permanent URL redirection test
header("Location: https://cmtoinchesconvert.com/tr/web/dev/php-redirect.html", true, 301);
exit();
?>

 

php-redirect-test.htm html dosyasından PHP yeniden yönlendirmesi, .htaccess veya httpd.conf dosyasında etkinleştirilmedikçe, .html dosya uzantısı nedeniyle genellikle çalışmaz:

 

PHP yönlendirme testi - HTML dosyası

 

HTML dosyalarında PHP'yi etkinleştirmek için bu kodu .htaccess veya httpd.conf dosyasına ekleyin:

Addtype application/x-httpd-php .htm .html

 

URL yönlendirme ►

 


Ayrıca bakınız

Advertising

WEB GELİŞTİRME
°• CmtoInchesConvert.com •°