Redirect using PHP rather than redirects in Cpanel -
probably question has been asked before cannot seem find satisfying answer.
i have following urls website:
mywebsite.com/profile.php?id=abc mywebsite.com/profile.php?id=xyz mywebsite.com/profile.php?id=mno
i create redirects enter url
mywebsite.com/abc redirect mywebsite.com/profile.php?id=abc mywebsite.com/xyz redirect mywebsite.com/profile.php?id=xyz mywebsite.com/mno redirect mywebsite.com/profile.php?id=mno
i either url entered mywebsite.com/abc , changed mywebsite.com/profile.php?id=abc in browser's address bar or remain mywebsite.com/abc.
i know how using redirects tool in cpanel - more efficient me using php and/or pdo rather creating each 1 manually.
i know asked php way this, .htaccess rule, add 1 rule , work urls:
rewriteengine on rewriterule ^([^/]*)$ /profile.php?id=$1 [l]
this accomplish want:
mywebsite.com/mno redirect mywebsite.com/profile.php?id=mno mywebsite.com/abc redirect mywebsite.com/profile.php?id=abc mywebsite.com/xyz redirect mywebsite.com/profile.php?id=xyz mywebsite.com/mno redirect mywebsite.com/profile.php?id=mno
Comments
Post a Comment