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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -