header("location") causes [500] internal server error?

header("location") causes [500] internal server error?

header html css
header php
header design
header word
header football
header construction
header and footer
header twitter

I cannot figure out what could be causing this error. My Apache log is not recording any errors in the access log or error log regarding the page, yet somehow whenever I uncomment the header() line I get a 500 Internal Server Error. It can't be coming from PHP's fatal error when content is outputted before header() is called, that wouldn't cause a 500 would it?

header("Location: /offices/page-".ceil($cache->size() / 15));

I tested $cache->size() and it's returning 22, so it should append a 2 to the end of the string and redirect. I did have ob_start() called before the header() but I tried calling ob_end_clean() right before it and it still did nothing...

I even tried putting header("Location: /offices"); at the very beginning of the file and it still gives me a 500.


The script continues to execute after your header() call. You need put exit; immediately after it. This shouldn't cause a 500 error, though.

Edit: Evidently this worked - meaning your problem is probably in some related code further down the page?

<header>, a line or block of text appearing at the top of each page of a book or document. Header definition is - one that removes heads; especially : a grain-harvesting machine that cuts off the grain heads and elevates them to a wagon. How to use header in a sentence.


Try to use a fully formed URL:

header("Location: http://{$_SERVER['HTTP_HOST']}/offices/page-".ceil($cache->size() / 15));

Page header, a raised tank of water maintaining pressure in a plumbing system. header - a framing member crossing and supporting the ends of joists, studs, or rafters so as to transfer their weight to parallel joists, studs, or rafters beam - long thick piece of wood or metal or concrete, etc., used in construction 5. header - a machine that cuts the heads off grain and moves them into a wagon


Another reason might be - you need to remove space after location :

header("location : header("location:

If that's not your problem, then try to check the php & apache error logs.

Header (computing), a person who ropes a steer by its head (as opposed to its heels), especially in a team-roping rodeo event. noun a person or thing that removes or puts a head on something. a reaping machine that cuts off and gathers only the heads of the grain. a chamber to which the ends of a number of tubes are connected so that water or steam may pass freely from one tube to the other.


I had the same thing going on. After repeatedly banging my head on the monitor, it isn't the header("Location: myPage.php"); line that is broken - it is myPage.php that is broken! Try redirecting to another page. I hope I save someone else time

Header, "the steer ran straight and the header made a good catch" Definition and Usage The <header> element represents a container for introductory content or a set of navigational links. A <header> element typically contains: one or more heading elements (<h1> - <h6>)


header - Manual, A <header> element typically contains: one or more heading elements (<h1> - <​h6>); logo or icon; authorship information. Note: You can have  Header (computing) In information technology, header refers to supplemental data placed at the beginning of a block of data being stored or transmitted. In data transmission, the data following the header is sometimes called the payload or body.


Header, In information technology, header refers to supplemental data placed at the beginning of a block of data being stored or transmitted. In data transmission, the​  1) In a document, a header is some combination of text and image s that can be made to appear at the top of each page when displayed or printed. 2) In e-mail, the header is the part of a message that describes the originator, the addressee and other recipients, message priority level, and so forth.


Header, Header may refer to: Contents. 1 Computers and engineering; 2 Construction; 3 Sports; 4 Other; 5 See also. Computers and engineering[edit]. Header  Header file, a text file used in computer programming (especially in C and C++) A pin header is a mainly male style of electrical connector on printed circuit boards, including motherboards, providing links to external devices Exhaust manifold, in automotive design Construction [ edit ]