It is not possible for your server side PHP code to detect if Javascript is disabled.
If you put the PHP code inside the tag <noscript>, it will always execute, regardless of whether Javascript is enabled or not. However, the output of the code will only be displayed if Javascript is disabled.
You might want to use Javascript to redirect to a separate page.
SLaks source
share