Apache not serving anything for errors - html

I have Apache set up through XAMPP on a Windows 7 x64 system, and for some reason it isn't serving any error pages. I have
ErrorDocument 404 /404.html
set up in both httpd.conf and .htaccess in my webroot dir, but whenever I purposefully request a page that doesn't exist to test it, Apache returns nothing at all - not my 404 error page or the default Apache 404 page, just a blank page, with nothing in it at all. I think this is one of the "soft 404" problems, because the Apache logs and Chrome both say that the request for the non-existent page resulted in a 200 OK response, but I have no idea how to fix it, because I'm not getting anything from the server. The logs don't tell me anything, and my searches on Google / etc. haven't resulted in any solutions for the problem I'm facing. Could it be that because I'm using a PHP semi-redirect script to route all requests that would have gone to http://localhost/* to http://localhost/testing/ that errors are being generated and then interpreted as not errors? For example, a request for http://localhost/foo.html will redirect to http://localhost/testing/ (not /testing/foo.html, but this is expected behavior), but a request for http://locahost/testing/foo.html (which doesn't exist) will result in a empty page and a 200 OK from Apache. If I request a page that exists though I usually get what I want, but sometimes Apache will also send back nothing at all for a PHP script that exists - for example I'm playing with sNews, and a request for index.php (http://localhost/testing/snews/index.php) will result in a blank page, even when the page has HTML that should display even if nothing is parsed / inserted.
Other then this, PHP, MySQL, Perl, and almost everything else works perfectly. A normal page will load if it exists, and the only problems that exist are those explained above, and this is really annoying because it's preventing me from finishing a certain project. Any help at all is greatly appreciated.

Just to close this question despite how long it's been since it was relevant:
Problem was Apache and PHP had conflicting directives - PHP would route all requests for / to /testing and Apache would look for error pages in / but get redirected by PHP and therefore fail.

Related

Webpage with ampersand in its name suddenly stopped loading ("bad request")

My boss has tasked me with remaking his business website from the ground up. I'm pretty new to web design and am learning as I go. Our webhost created a WordPress staging site that I can work on while the original site stays up and running. Recently we've encountered a real problem: a very important page on our original (current) website has a filename that includes an ampersand. It loaded perfectly for customers for over a decade, but now suddenly refuses to load, returning a "bad request" error message for any browser we've tried. The page's URL is in this format:
www.example.com/Gems&Rocks.htm
I changed all instances of '&' to 'n' in the HTML code as well as the file names associated with it, and that got the page working again. Problem is, there are hundreds of other pages across the internet that backlink to this important page under its original name. My boss is adamant that I find a way to get the original filename with the ampersand in there so we don't lose business. He thinks this is all my fault, but I did absolutely nothing to change the old website. The webhost's tech tells me he can't do anything about it, and that this emergent problem wasn't caused by anything he did because he hasn't changed anything on the webserver in over a year. He says the '&' is a reserved character and shouldn't have been in the pathname anyway. Nevertheless, our page loaded just fine for many years.
Searching the web has done me no good, it's like I'm the only person in the world who has encountered this problem. But surely someone else has had such a thing happen. So I guess my specific questions are:
Did pages with '&' in their name suddenly stop loading for everyone or just our website?
Is there a way to "trick" our website into loading the page instead of deciding the '&' is a "bad request"?
Can a URL redirector be set up that sends users from "Gems&Rocks.htm" to GemsnRocks.htm?
The "bad request" error comes from your web host's server. If it worked previously, but now shows that error, then something MUST have changed on the server.
It is possible that you might be able to redirect that request. You don't say what server your web host is using. It's likely to be some version of Apache and you probably have .htaccess configuration available to you. One option might be to put something like this in your .htaccess file:
RedirectMatch 301 ^/Gems\&Rocks\.htm$ https://example.com/GemsnRocks.htm
Whether or not that works will depend on the server that you are running on and how it is configured.

Node/Express server hangs intermittently but automatically continues after a pause

Unfortunately I cannot put the code here because despite all kinds of debugging I cannot point to the problem to present the problematic segment of the code. If I try to load a HTML which in turn has other requests (js,css,png, etc.), it loads all except one... The server/browser hangs for some time and then after about a minute or so does actually load! If I try to test the server with individual manual requests of these very URLs in the HTML file, it works fine.
While tying to load the HTML file, Chrome Network tab shows "pending..." of one request or sometimes two. But ultimately all the URLs requested are served. Thats what bugs me...
I tried to set http.globalAgent.maxSockets to 100 as suggested here as the HTML file would make more than 8 requests for the different js, css, etc. This did not help either.
I have reached a deadend. Any help would be appreciated.

webpage: how to automate detection if webpage returns error?

I have a webpage generated by an application server (GlassFish) using JSP pages. If the application server goes down, the webpage returns an error (can't find file).
Is there any way to set things up so I get an email when someone visits this page and observes an error? For example, using .htaccess or anything else (simple)?
Alternatively, is there a way I can automate pinging the webpage somehow every 30 minutes and send me an email if the webpage returns an error?
Or, anyway to automate querying the application server and notifying me when it goes down?
What's the specific error? I would imagine it's a 404 Can't Find File, unless the application itself is throwing the error.
If it's 404 then in your htaccess file add:
ErrorDocument 404 http://www.domain.com/404page.html
Create a document called 404page.html and add it to your root directory via FTP. Put something meaningful to the user so they know there is an error. To inform you for the error you could create an auto submit form:
Auto submit form
Then you would need a simple php mailing script to grab the posted variables and mail send them via e-mail.
If it's not 404 you need to figure out where that error is being thrown from and add in an error page. But if the apps server is going down, I highly doubt it's responsible for throwing the error.

From the browser, how to make the web server refresh/invalidate a cached static-html-webpage?

PROBLEM:
Today, we modified a static html web page in a client's website -
we added a couple of images and modified the font. And FTPed the file to client's web server.
We realized we made a mistake with the font-size, corrected it, and FTPed the file again.
Even with a 100 refreshes, the website was displaying only the file (with wrong font) that we had FTPed the first time.
We FTPed the corrected file several times, but the file with the wrong font was the only file being served by the web server.
OUR GUESS:
We think that the web server cached the file that we had FTPed the first time, and is serving it back to us on subsequent requests even though the file had changed.
We tried the following techniques (but were unsuccessful):
We added a parameter to the querystring (?R=33343545)
We tried the technique suggested below - i.e. posting to the webpage in question, but got a "405 Method not allowed. The HTTP verb used to access this page is not allowed."
http://www.mnot.net/blog/2006/02/18/invalidation
Please advise if we were on the right path and if there is anything else that we can try in such situations ?
EDIT:
We would like to find out if there is a way (similar to the 2 methods above) to do it just from the browser..and not touch the settings on the webserver.

Cannot find URL when duplicating site

So I have a booking system on my website with the URL domain.co.uk/booking. I wanted to add it to a different site I have, domain.com.au/booking. It is a simple drag and drop then run an install.php file. However my domain.com.au/booking does not find anything there. the files are there in the EXACT same way as they are in my domain.co.uk site which runs fine. Are there any reasons why the path would not be found that i may simply be over looking?
N.B the error that appears is
The requested URL /booking/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
If you are on a linux server, /booking/ does not equal /booking. That could explain the difference between the two sites (one is hosted on linux, the other is not).
Though this is just a wild guess.