Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Dont send 404

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Max execution time  
Author Message
c98afs

External


Since: Mar 25, 2004
Posts: 2



(Msg. 1) Posted: Thu Mar 25, 2004 7:49 pm
Post subject: Dont send 404
Archived from groups: alt>apache>configuration (more info?)

This is what Im trying to do:

When somone tries to access a page that doesnt exists i want to redirect
the user to another page. I have solved this with a .htaccess file and
ErrorDocument and it works just fine.

The problem is that apache sends both the page and HTTP/1.1 404 Not Found.
This is a problem since I am browsing with a mobile phone, and mobile
phones are stupid devices that just looks at the response code (404) and
says, "Page not found", and does not care about the rest.

So i would like to configure apache so that it redirects the user without
sending the 404 response code, the best would be if it sent response code
200. Is this possible? Is there some kind of workaround available out
there?

I really hope somone out there can help me with my problem...

Best regards
Andreas

________________________________
Andreas Friis - c98afs.DeleteThis@cs.umu.se
070 - 173 95 45 / 090 - 19 52 65
Fysikgränd 33 907 31 Umeå

 >> Stay informed about: Dont send 404 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 2) Posted: Thu Mar 25, 2004 7:49 pm
Post subject: Re: Dont send 404 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Andreas Friis <c98afs.RemoveThis@cs.umu.se> wrote:
 > The problem is that apache sends both the page and HTTP/1.1 404 Not Found.

AFAIK this can't be changed, since the 'error code' is part of the
way Apache handle the stuff.

 > sending the 404 response code, the best would be if it sent response code
 > 200. Is this possible?

Well, if you handle the requests trough a CGI or a server-executed
script, he will always receive a 200, but then you can handle the
'404' on your own. Of course this means potentially rewrite the whole
site... is it worth it? In this case isn't Apache the problem but is
the client that is broken.

Davide

--
| It is better never to have been born. But who among us has such luck?
| One in a million, perhaps.
|
|<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Dont send 404 
Back to top
Login to vote
alvaro_quitar_1

External


Since: Oct 31, 2003
Posts: 86



(Msg. 3) Posted: Fri Mar 26, 2004 12:36 pm
Post subject: Re: Dont send 404 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*** Andreas Friis wrote/escribió (Thu, 25 Mar 2004 16:49:31 +0100):
 > So i would like to configure apache so that it redirects the user without
 > sending the 404 response code, the best would be if it sent response code
 > 200.

The error can page can be a dynamic page (for instance, PHP). Most
server-side scripting languages allow you to change HTTP response headers.

--
--
-- Álvaro G. Vicario - Burgos, Spain
--<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Dont send 404 
Back to top
Login to vote
c98afs

External


Since: Mar 25, 2004
Posts: 2



(Msg. 4) Posted: Fri Mar 26, 2004 5:18 pm
Post subject: Re: Dont send 404 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 25 Mar 2004, Davide Bianchi wrote:

 > Andreas Friis <c98afs.TakeThisOut@cs.umu.se> wrote:
  > > The problem is that apache sends both the page and HTTP/1.1 404 Not Found.
 >
 > AFAIK this can't be changed, since the 'error code' is part of the
 > way Apache handle the stuff.

I managed to solve my problem with this work around:

RewriteEngine on
RewriteRule ^.*$ /my-script.php


  > > sending the 404 response code, the best would be if it sent response code
  > > 200. Is this possible?
 >

....

 > In this case isn't Apache the problem but is the client that is broken.

Absolutely! But its hard for me to make Nokia, Ericsson and all the other
mobile phone manufacturers to write good WAP-browsers Wink

Andreas

 > Davide
 >
 > --
 > | It is better never to have been born. But who among us has such luck?
 > | One in a million, perhaps.
 > |
 > |
 >

________________________________
Andreas Friis - c98afs.TakeThisOut@cs.umu.se
070 - 173 95 45 / 090 - 19 52 65
Fysikgränd 33 907 31 Umeå<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Dont send 404 
Back to top
Login to vote
kd6lvw

External


Since: Nov 02, 2003
Posts: 31



(Msg. 5) Posted: Mon Mar 29, 2004 10:53 am
Post subject: Re: Dont send 404 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 25 Mar 2004, Andreas Friis wrote:
 > This is what Im trying to do:
 >
 > When somone tries to access a page that doesnt exists i want to redirect
 > the user to another page. I have solved this with a .htaccess file and
 > ErrorDocument and it works just fine.
 >
 > The problem is that apache sends both the page and HTTP/1.1 404 Not Found.
 > This is a problem since I am browsing with a mobile phone, and mobile
 > phones are stupid devices that just looks at the response code (404) and
 > says, "Page not found", and does not care about the rest.

The problem is the client program built into your phone, not the server.

 > So i would like to configure apache so that it redirects the user without
 > sending the 404 response code, the best would be if it sent response code
 > 200. Is this possible? Is there some kind of workaround available out
 > there?
 >
 > I really hope somone out there can help me with my problem...

Complain to your phone service provider or manufacturer.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Dont send 404 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 6) Posted: Tue Mar 30, 2004 12:10 am
Post subject: Re: Dont send 404 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Andreas Friis" <c98afs.RemoveThis@cs.umu.se> schreef in bericht
news:Pine.GSO.4.58.0403261415330.18909@peppar.cs.umu.se...
 > On Thu, 25 Mar 2004, Davide Bianchi wrote:
 > I managed to solve my problem with this work around:
 > RewriteEngine on
 > RewriteRule ^.*$ /my-script.php
As the RewriteEngine is available to you, try
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) /fnf.wap [PT,L]

just neither a non-zero-lenght file, nor a folder is there, throw a silly
file to the client Wink

  > > In this case isn't Apache the problem but is the client that is broken.
Though, some might say your content ...

HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Dont send 404 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Something I still dont get about VirtualHosts - Hey everybody, ok this problem has been bothering me for some time now. I'm hosting a website at home using a custom dns from dyndns.org. Now i have dns records for both www.myhostname.com and rasiel.myhostname.com to both point to my ip address. What i....

Form-Data not send. - Hi! I have the following Problem with the apache Webserver on my local machine: The form-data entered in forms in html are not send to the php-script named in "action". It would be very cool if there were a fast way to fix this Problem. THX, ...

how to have apache pick up right domain name when send for.. - Hello, I have several web sites virtually hosted on one machine, and this machine has two domains (I mean they have zone files setup on this machine). When sending form mail from any one of those web sites, one of the two domain names will be picked up....
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]