Re: Workaround ISP's redirect of 404 Not Found PHP pages?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 3:32 PM +0000 1/26/06, James Benson wrote:
 PHP is running as a CGI on the shared hosting servers, which is
 why your .htaccess isn't working for it.

 You will have to create the error rule within a php.ini file.

That is so much bull, how then can it work for NON .php files?

I know for a fact that CGI does not prevent you using .htaccess or the ErrorDocument directive in apache because Im using one myself right now in CGI mode and it works just fine, does your webhost use a custom error page that advertises its own services or provides a link to their website by any chance?

Well, laboring under the assumption that everything they tell me is bull, I looked the other way and found a solution. Thanks also to Barry for this:

At 3:42 PM +0100 1/26/06, Barry wrote:
Best thing is probably to use a rewrite rule.
So if the error.html should be desplayed the rewrite rule opens the .php file.

In .htaccess, I replaced

  ErrorDocument 404 /not_found.php

with

  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) /not_found.php

and it seems to be working.

Many, many thanks to you both. I should have started here - it would have saved me about two weeks. No lie.

Peace,
Jim

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux