I have a page by name of barbad.php it is in folder /p/ but now i have created a page with the same name in another folder ,it is in folder /play/ and i want that when in search engine find the link like below :
music/p/barbad.php?Albumid=695&artistid=184&trackid=6091
then user redirect to address below:
music/play/barbad.php?Albumid=695&artistid=184&trackid=6091
thanks for your help.
in p/barbad.php
you can simply redirect to play/barcode.php
. You need to use the same query string so $_SERVER['QUERY_STRING']
is append with redirection url.
<?php
$queryString = $_SERVER['QUERY_STRING'];
header("Location:../play/barbad.php?".$queryString);
die();
?>
Use Apache mod_rewrite
Add to htaccess
RewriteEngine on
RedirectMatch ^music/p/barbad.php?Albumid=([0-9]+)&artistid=([0-9]+)&trackid=([0-9]+)$ http://domainname/music/play/barbad.php?Albumid=$1&artistid=$2&trackid=$3 [R=301,L]
Try, it using .htaccess file,
#.htaccess
RewriteEngine On
RewriteRule ^music/p/barbad\.php(.*)$ http://yourdomain/music/play/barbad.php$1 [L,R=301]