I have a redirect script which I used on all the external links on my site. redirect.php?url=http://someexternallink I happned to move host and the php script no longer works, it is a simple php redirect script. The new host is running latest version of php, unlike the previous host. Following is the script... I can no longer find the same online. <?php if (!isset($_GET['url'])) die('Invalid URL'); $newurl = trim(substr($_SERVER['QUERY_STRING'], 4)); if (strlen($newurl) < 1 || !preg_match('/^(ftp|http|news|https):\/\//i', $newurl)) die('Invalid URL'); $htmlurl = htmlentities($newurl); ?> <html> <head> <meta http-equiv="refresh" content="0;url=<?php echo $htmlurl; ?>"> <style type="text/css"><!-- BODY { background: #FFFFFF; color: #000000; } .url { text-decoration: underline; color: #991111; background: transparent; } .info { text-align: center; background: #bbbbFF; color: #000000; padding: 5pt 5pt 5pt 5pt; border: 1px solid #000000; } --></style> </head> <body> <table border="0" width="100%" height="100%"> <tr> <td align="center" valign="middle"> <table class="info" border="0" cellspacing="0" cellpadding="2"> <tr> <td><b>Redirecting you to the following url</b><br /><span class="url"><?php echo $htmlurl; ?></span></td> </tr> </table> </td> </tr> </table> </body> </html> PHP: Please help me make it work, the script is returning a 500 internal error on the new host.
seems to be no issues on you script, maybe you can ask your new host why error 500 is happening. is it happening on this script only?
More then likely a .htaccess problem You might need to to add or remove the following: RewriteBase / Code (markup): EDIT: as above post...
The htaccess did not help. Can this be a security issue? I tried to redirect the script to my own domain and it does redirect. It will not redirect to external links only.
It (500) seems to be happening to few other scripts also but I was able to work around it, not all scripts are affected.
500 is a server error, it doesn't tell you what server error. You'll have to get your providerr's tech support involved, so they can look in the server error log and tell you what the error is. If it's an Apacjhe server, t'll be in the form of [Tue Sep 13 09:59:36 2011] [error] [client 1.2.3.4] PHP Parse error: syntax error, [some problem] in C:\\Apache2.2\\htdocs\\[some file].php on line [some line], referer: [some file] You need the [some problem], [some file] and [some line] parts to determine where the problem is. Then you look at that line in that file (it'll probably be your redirect script) to see where the error is. The script seems to run fine in PHP 5.2.6 on an Apache 2 server.