How to add 301 redirects in PHP?

by heather_fritsch , in category: Technology , 3 years ago

How to add 301 redirects in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by aaliyah , 3 years ago

You can add 301 redirect in PHP by adding below code snippet in your file.


1
2
3
header("HTTP/1.1 301 Moved Permanently"); 
header("Location: /option-a"); 
exit();