PHP રીડાયરેક્ટ

PHP પૃષ્ઠથી URL પર રીડાયરેક્ટ કરો. PHP 301 રીડાયરેક્ટ.

આ PHP રીડાયરેક્શનને HTTP પ્રતિસાદ સ્થિતિ કોડ પરત કરવો જોઈએ: 301 કાયમી રૂપે ખસેડવામાં આવ્યો.

જૂના URL થી નવા URL પર પેજ રેંક ટ્રાન્સફર કરવા માટે શોધ એંજીન 301 પ્રતિભાવ સ્થિતિ કોડનો ઉપયોગ કરે છે.

PHP હેડર રીડાયરેક્ટ

જૂના-page.php કોડને નવા-page.php પર પુનઃદિશામાન કોડ સાથે બદલો.

old-page.php:

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

જૂના પૃષ્ઠમાં .php ફાઇલ એક્સ્ટેંશન હોવું આવશ્યક છે.

નવું પૃષ્ઠ કોઈપણ એક્સ્ટેંશન સાથે હોઈ શકે છે.

PHP રીડાયરેક્ટ ઉદાહરણો

ઉદાહરણ #1

php-redirect-test.php

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

 

php-redirect-test.php થી આ પૃષ્ઠ પર પાછા રીડાયરેક્ટ કરવા માટે આ લિંક દબાવો:

 

PHP રીડાયરેક્ટ ટેસ્ટ - PHP ફાઇલ

ઉદાહરણ #2

php-redirect-test.htm

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

 

html ફાઇલ php-redirect-test.htm માંથી PHP રીડાયરેશન સામાન્ય રીતે .html ફાઇલ એક્સ્ટેંશનને કારણે કામ કરશે નહીં, સિવાય કે તે .htaccess અથવા httpd.conf ફાઇલમાં સક્ષમ ન હોય:

 

PHP રીડાયરેક્ટ ટેસ્ટ - HTML ફાઇલ

 

HTML ફાઇલોમાં PHP ને સક્ષમ કરવા માટે આ કોડને .htaccess અથવા httpd.conf ફાઇલમાં ઉમેરો:

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

 

URL રીડાયરેક્શન ►

 


આ પણ જુઓ

Advertising

વેબ વિકાસ
°• CmtoInchesConvert.com •°