Re: Workaround ISP's redirect of 404 Not Found PHP pages?
| From: | Jim McIntyre | Date: | Thu, 26 Jan 2006 16:04:35 +0000 |
| Subject: | Re: Workaround ISP's redirect of 404 Not Found PHP pages? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229321@lists.php.net to get a copy of this message | ||
At 3:32 PM +0000 1/26/06, James Benson wrote:
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: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?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.
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