I have built a few themes and noticed that the 404 pages, once uploaded to my server. never appear. They always do on my localhost setup, and even themes for others have worked.
I see no reason for it not to work, I have mod_rewrite enabled for the pretty permalinks but the 404 redirection seems not to want to work.
Is this a known issue?
Is it my shitty server with S开发者_运维问答treamline.net?
Can anyone help?
You can try setting your own error documents in .htaccess and that may override your hosts settings and that point to a static wordpress page called "error" or your 404.php in your theme
ErrorDocument 401 http://mydomain.com/error/
ErrorDocument 403 http://mydomain.com/error/
ErrorDocument 404 http://mydomain.com/error/
ErrorDocument 500 http://mydomain.com/error/
Edit: You can also do a redirect in your theme's 404.php file (yes, it's ugly...) to your static error page: <?php
Header("Location: http://mydomain.com/error/");
?>
If that doesnt work, I don't know.
Suffering from the same issue with Streamline. I guess it's due to the apache version used by this hosting 1.3.
If you have already a 404.php file in you theme template, if not create one. Then follow the steps below.
Step One: open you existing 404.php file in any editor, or create new one in theme directory.
Step Two: Copy/Paste below provided code in you 404.php file (make sure your 404.php file blank)
//404 Redirect to home in WordPress.
//Sara Domini
//301 Permanently Redirect
//http://2experts.net
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
For me and other works like a charm :))
It's rather bizarre that this is happening. If WordPress is working with pretty permalinks, then Apache is doing it's job - rewriting any URL that doesn't physically exist to WordPress.
It's then up to WP to decide if the request doesn't match anything, and if so, display a 404.
Perhaps Streamline is screwing this up, by reading the '404 Not Found' header that WP kicks out and fiddling with the output?
精彩评论