This is a discussion on Feedback on WP Error404, url rewriting within the Web servers forums, part of the Mastering Servers category; Hello I would like to have feebacks, from people who are using this rewriting Lighttpd and wordpress setup clean SEO ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hello
I would like to have feebacks, from people who are using this rewriting Lighttpd and wordpress setup clean SEO friendly URLs Is there some problemes with indexation in search engines (indeed the tip is using an error redirection to do the rewrite), thanks in advance Mumuri |
| Sponsored Links | ||
|
|
|
|||
|
ok perhaps i didn't understand everything (i m not using this tips for a word pres
![]() here is a test, i ve set up an 404 pages with Code:
ErrorDocument 404 /mypage.php now i create a dummy url like this http://shopog.com/seo-test-error-document.html Code:
curl http://shopog.com/seo-test-error-document.html -I HTTP/1.1 404 Not Found Date: Sat, 24 May 2008 12:44:44 GMT Server: Apache X-Powered-By: PHP/4.4.8 Vary: Host Content-Type: text/html which is quite logical: wrong url ---> 404 error --> redirection to mypage.php --> send page to browser So if i look at your first test curl -I ht tp://www.cyberciti.biz/tips/lighttpd-and-wordpress-setup-clean-seo-friendly-urls.html what does it mean ? the only solution i see to do that is that the header is changed in the php file wrong url ---> 404 error --> redirection to mypage.php --> 200 ok ---> send page to browser where 200 ok is added directly in the php file will test that thanks |
|
||||
|
This hack is wordpress specific ONLY. Wordpress has built in support for modifying headers for 200 / 404 status code and templates are designed for the same. For your custom made apps or any other open source software (other than WP) I recommend mod_rewrite.
HTH |
|
|||
|
ok i set up this
mypage.php Code:
<?php
header("HTTP/1.1 200 OK",true,200);
?>
hello world, postnuke
Code:
~# curl http://shopog.com/mypage.php -I HTTP/1.1 200 OK Date: Sat, 24 May 2008 12:52:58 GMT Server: Apache X-Powered-By: PHP/4.4.8 Vary: Host Content-Type: text/html ~# curl http://shopog.com/seo-test-error-document.html -I HTTP/1.1 404 Not Found Date: Sat, 24 May 2008 12:53:04 GMT Server: Apache X-Powered-By: PHP/4.4.8 Vary: Host Content-Type: text/html why a 200ok is send even if it s a 404 ? will look at wordpress error file EDIT : i ve look and extrated all redirection stuff of wp, then i created this file Code:
<?php
function absint( $maybeint ) {
return abs( intval( $maybeint ) );
}
function get_status_header_desc( $code ) {
global $wp_header_to_desc;
$code = absint( $code );
if ( !isset( $wp_header_to_desc ) ) {
$wp_header_to_desc = array(
100 => 'Continue',
101 => 'Switching Protocols',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported'
);
}
if ( isset( $wp_header_to_desc[$code] ) )
return $wp_header_to_desc[$code];
else
return '';
}
function status_header( $header ) {
$text = get_status_header_desc( $header );
if ( empty( $text ) )
return false;
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
$protocol = 'HTTP/1.0';
$status_header = "$protocol $header $text";
if ( function_exists( 'apply_filters' ) )
$status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol );
if ( version_compare( phpversion(), '4.3.0', '>=' ) )
return @header( $status_header, true, $header );
else
return @header( $status_header );
}
header('Content-Type: text/plain');
status_header('200');
exit;
?>
will look at that Last edited by mumuri; 05-24-2008 at 06:53 PM. |
|
||||
|
You also need server.errorfile-prefix lighttpd.conf to get 200 and 404 and other code correctly :
Code:
server.errorfile-prefix = "/home/lighttpd/errors/status-" /home/lighttpd/errors. Based on the above entry you must name your files status-(status-code).html Code:
/home/lighttpd/errors/status-404.html /home/lighttpd/errors/status-500.html /home/lighttpd/errors/status-501.html |