Date: 04/08/05 (PHP Community) Keywords: php, browser, css, html, web, apache I'm trying to use mod_rewrite to intercept all requests made to my web server and route them to a php file (index.php) which then parses the request and does what it can to serve the appropriate page. I'm doing this in an effort to use meaningful URLS as opposed to query strings. RewriteEngine on RewriteRule index.php$ - [L] RewriteRule !\.(jpg|gif|css)$ /index.php [L] And this is the code I'm using in index.php that's causing a problem: if ($url_array[0] == 'poems') { // POEMS SUBDIRECTORY require('lists.php'); // GET LISTS $get = 'poems'; if (array_search($url_array[1], $poem_list)) { $which = $url_array[1]; include('get.php'); } else { if (!headers_sent()) { header('HTTP/1.1 404 Not Found'); } } } else { if (!headers_sent()) { header('HTTP/1.1 404 Not Found'); } } As you can see, I'm checking to see if headers have been sent before trying to set them, but they don't seem to have been. Whenever I try to set a status header with the syntax HTTP/1.1 XXX (description) an internal server error occurs. I have been able to set status using the header Status: 404, but rather than the standard 404 error page appearing a blank HTML document is served to the browser. Apache version is 1.3.19 running on Windows 98. PHP version is 4.2.3 running as a cgi. Any help would be much appreciated, I'm pretty far out of my depth with changing the way Apache works. Source: http://www.livejournal.com/community/php/281753.html
|