I'm trying to write a very dynamic custom 404 page. Using ErrorDocument, I'm able to make the page display, the only problem is that I want to be able to pass POST data (instead of just GET/QUERY_STRING) data, and it doesn't seem to work.

Apache defines a couple of variables if the redirect is on the same server such as REDIRECT_QUERY_STRING, REDIRECT_REQUEST_METHOD, etc, but as far as I can tell, no way to get to the POST data.

If anybody has had any experience with this sort of thing, I would appreciate hearing their knowledge!

Tom Brown
Netnexus: Where gamers play
http://www.netnexus.com

    I had a similar problem using apache, the 404 error handler cannot pass the post data across.

    After much searching and a variety of attempts the only work that seemed to work was to use mod_rewrite instead.

    used that now in several places and it works a charm.

      this is a sample .htaccess file with the mod_rewrite working

      header("HTTP/1.0 200 Success"); 
      require_once("config.inc.php");
      
      $origprofile = $_SERVER['REQUEST_URI'];
      if(strpos($origprofile,'/') === 0)
      {
        	 $origprofile = substr($origprofile,strlen('/'));
      }
      
      (some code in here to decide what I want to do)
      
      
      require_once("footer.inc.php");
      
      

        Do you know of a way to selectively use mod_rewrite only if the page isn't found?

        The problem is that there will be many different sections of my site, all changing dynamically, and it will be impractical to either change the .htaccess (or httpd.conf) files for each request (because of the rapidly changing nature, and the server-farm configuration). The solution I thought of was to just catch all 404 errors, get the alias from a database to the real site, and load that page... Without letting the user in on the real URL.

        So if I have to use mod_rewrite, for speed purposes, I only want to use it when the request would not be found otherwise.

        Any ideas on the general problem (maybe an apache module I don't know of) or the solution?

        Tom Brown
        Netnexus: Where gamers play
        http://www.netnexus.com

          oops, it was the .htaccess setup I meant to post actually not the script....

          here you go

          <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule (.*) /handler.php
          </IfModule>
          
            2 months later

            Gosh, how to add gold stars to this post.

            I decided to do a bit of reading and playing around on the mod_rewrite front. Found the article at http://www.phpfreaks.com/print.php?cmd=tutorial&tut_id=23 and thought "piece of cake". Hours later I've read masses more stuff and am still hitting 500 errors.

            What I hadn't found was the big saying you need

            <IfModule mod_rewrite.c>

            put that in and it's all working just fine!

            thanks heaps raymie

              Write a Reply...