Why does my wordpress 404 page appear blank? - wordpress

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 Streamline.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?

Related

How to redirect file not found error on wordpress

I have a wordpress site in which I want to redirect all the FILE NOT FOUND 404s.
example : wwww.xyz.com/abc.php
if abc.php does not exist on the server it should be redirected to home page.
I have successfully redirected page not found 404s but having issues in redirecting this one. Can it be done using any plugin?
Why not create a 404.php page within your theme and then put in the following code to redirect?
<?php
header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>
Hope this helps.
For redirection there is a nice WordPress plugin which can do that quite simply - https://wordpress.org/plugins/simple-301-redirects/
But if the issue is that the webserver is showing the default 404 page and not the one within WordPress you should check if .htaccess is present, mod_rewrite is installed . Are the existing pages in WP redirecting properly?

Unable to fix garbage url

I am having a problem http://prntscr.com/587iwz
Generally any garbage/wrong URL should goto 404 page but in my case, it is going to some uploading page.
I am using Presscore theme.
Take a list of plugins and figure out the suspected plugins.. you could put a temporary maintenance plugin... or else check by deactivating the plugins when the traffic is less to website. Theme appears to be no issue. Then the possible problem could be either .htaccess or plugins.
Find that particular link in your web files and replace it, that's it.
You can use notepad++ or similar programs to search text in multiple files. My advice to you would be to not use nulled themes downloaded from random websites
Look at your .htaccess
Try adding this:
ErrorDocument 404 http://example.com/404/
ErrorDocument 500 http://example.com/500/
or map them to one error document:
ErrorDocument 404 /pages/errors/error_redirect.php
ErrorDocument 500 /pages/errors/error_redirect.php

Wordpress Multisite - This webpage has a redirect loop

I had installed a Wordpress Multisite on my localhost, it works ok but when I put it on server and changed all URL stuffs on DB I got this error: Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
Someone knows how to fix it?
The problem seems to be in your .htaccess file.
If you have activated multisite, then go to your networg settings
and copy your .htacces code generated by wordpress.
Paste the code in .htaccess and update file on server.
Finally refresh you dasboard and try it!
Tell me it it's work!

WordPress - how to add a custom 500 server error page?

It seems easy to create a custom error page in WordPress for a bad page, i.e., a 404 not found - just create 404.php in the theme directory.
I'd like to do the same for a server error, say if a CGI script on my WordPress site does something stupid like divide by 0.
I tried creating a 500.php page in my theme directory but it appears to be ignored. Instead, the 404.php page in the theme directory is called.
It seems that WordPress somehow catches the server error and translates it into a "not found" error and then uses 404.php
How can I make WordPress go to a different custom page in case of a server error (500), as opposed to a simple page not found (404) error?
And before you tell me to put something like ErrorDocument 500 /path-to-custom-error-page in a .htaccess file, already tried that - it gets ignored by the web server, probably because the RewriteRule directives in the same file are used by WordPress to intercept and handle all requests (and no it doesn't matter if the ErrorDocument directive is above or below the WordPress RewriteRule section).
(Note: I tried researching this on my own, but search results are polluted by people complaining about getting server errors with WordPress, not asking how to create a custom page to handle them.)
WordPress will never be able to show your custom error page for a server error (500). You need to create a .html or PHP page, outside of WordPress. Your host may already have something to help you there, many have a folder into which you can put custom error pages, outside the website's root folder.
Since WP 3.0 you can override the standard error pages that wp_die() uses, with the wp_die_handler filter.
'wp_die' and 'wp_die_handler' are located in wp-includes/functions.php.
ErrorDocument 500 … should work in any case if the path is correct. Turn off WordPress's rewrite rules, produce a 500 error, and Apache should either show /path-to-custom-error-page or say it can't find it.

.htaccess: Codeigniter + Wordpress

I am developing site on Codeigniter and want to "connect" it with Wordpress.
So the URL structure will be
SITE-URL
-SITE-URL/folder1/
--SITE-URL/folder1/some-link
-URL/folder2/
...etc
What I need to do, is when Codeigniter throws 404 error, the content is taken from Wordpress website(same relative URL) without any redirects for end user.
Thanks
Not sure you can do this with .htaccess since .htaccess can only do re-directions before the content is served, meaning before Codeigniter has responded to the request. So when Codeigniter generates a 404, it's returning content an .htaccess isn't processed.
What you would need to do is generate a 404 controller that either does a redirect, which you don't want, but would be the easiest. Or the 404 controller would then have to load in wordpress and process the request through there. Something similar to proxy, but it will need to be done with PHP.

Resources