Replace JS redirect with PHP
Move inline JS to external file