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.
Related
My WordPress site having issue so not able to reach out to the domain.com/wp-admin, it's redirect to 404 error. I have been tried out for delete ".htaccess" file however it's not working.Cache and cookies of the browser also have been clear out. Would need some advise how can I reach out to my domain.com/wp-admin.
I have been tried for using domain.com/wp-admin.php. Disable plugin however it's also not working from my end to redirect on my side
Usually, a 404 error on /wp-admin/ is caused due to missing .htaccess in your website's root directory, so first thing first, make sure that you have a valid WordPress .htaccess ( https://wordpress.org/support/article/htaccess/ ).
After that, make sure that you do not have a plugin for a custom admin login as it might also cause this behavior. If the issue still persists after that, try accessing the admin login page at: yourdomain.com/wp-login.php
If none of the above work, you should ask your hosting provider for further help.
I'm current having an issue with Gravity Forms. I have several forms with an upload function, but when people upload a file i can't view it in the backend. It just leads to an 404 error.
The file destination is: /index.php?gf-download=2018%2F10%2FRegnskabsskabelon-International-transport.pdf&form-id=7&field-id=101&hash=923ee8ba8c7bb431ea0c6b60ac4b0b8cd345b1ed452d8b4d3bddf1579ea961bf
I can't seem to find the file in FTP.
I don't know how to troubleshoot this error or find the problem.
What i've tried:
Deactivating all plugins
Resetting permalinks
Using an standard theme
Updating Gravity Forms.
The error still occurs
Hope you can help
Currently on Gravity Forms Version 2.4.6
Best Regards
I was facing this issue with a client and just found a solution. It may not be universal though as most articles I found state that it is most likely a plugin conflict.
In my case it was simply an unwanted redirect of */index.html
There is already a redirect set in htaccess to route index.html to index.php and if there is a secondary redirect of index.html to a given page, you get a 404.
Hope this helps someone, as I haven't found any concrete solutions.
I also just encountered this problem, and after head much scratching discovered that one possible cause is if you have moved Wordpress to/from its own folder but moved the index.php file instead of copying it. Copying index.php back to its original location fixes the 404 error.
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
I've done a fully integration of a Wordpress in a Magento shop with FishPig, everything is working fine except that I can't find where or how to find/edit/set a custom 404 error page.
It's my first time using Magento and my php knowledge is very limited so any help would be much appreciated.
Btw, That's the default no-route error I get: http://doshaburi.com/blog/category/xx/
Thanks.
This isn't possible via a configuration setting in the extension. What you could do though, is include a .phtml file in your 404 page and then display a different piece of content if the URL starts with the blog route (eg. /blog/.*) to every other request.
The reason why I can't use the normal 404.php Wordpress template file is because of my host. An IP (crawler maybe) kept viewing 404 pages and sending SQL queries I guess. Since I'm on a shared host, they told me to install WP Super Cache (which I did) and add an ErrorDocument 404 directive in my htaccess file but that doesn't work.
Where it should be added so it overrides WP default one?
In the meantime, I've changed the 404.php to a simple html file. That won't send any SQL requests right?
Thanks a lot,
Cris
The 404 page (including the default one from WP) shouldn't be firing SQL queries. It's the page you end up on when the SQL has already determined it can't find what's being asked for.
One common reason for high SQL activity is how you've defined your permalink structure. It's tempting (but deadly) to use "postname". It's the most common way I can think of to get yourself into this kind of a problem.
But I'm sure there are more I haven't discovered yet...