i need to embed a html 301 redirect in my php code and i wanted to save chars in my html.
Can i write HTML on one line since it is parsed? Is there anything against this practice?
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>301 Moved Permanently</title></head><body><h1>Moved Permanently</h1><p>The document has moved <a href="<?php echo $location ?>">here</a>.</p></body></html>
<?
thank you
Best Answer
Your single-line HTML snippet will work fine. Improperly written browsers could conceivably choke on one-liners that exceed ridiculous maximum lengths, but in practice something like your snippet should not pose any problem.
Of course, since you work in PHP anyway, my preferred way of handling redirections would be something like:
But that's up to you. :-)