deansaddigh Posted September 4, 2010 Share Posted September 4, 2010 ok so i have a 404 error redirect which works well. my question is if you got to here the page displays http://www.languageschoolsuk.com/student_photos.htm but say you miss spell it like this http://www.languageschoolsuk.com/stuent_photos.htm it takes me to a blank page. why doesnt the 404 error come up. Kind regards Dean Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/ Share on other sites More sharing options...
cags Posted September 4, 2010 Share Posted September 4, 2010 If typing in an invalid address shows a blank page, then what exactly is your '404 error redirect which works well' doing? Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107238 Share on other sites More sharing options...
deansaddigh Posted September 4, 2010 Author Share Posted September 4, 2010 erm well thats a good question. if you go here http://www.languageschoolsuk.com/school_details and forget the trailing slash it works heres my htacess file RewriteEngine on #change mask php files RewriteRule ^(.*)\.htm$ $1.php [NC,L] #seo friendly url RewriteRule ^school_details/([a-zA-Z_|.-]+)/? school_details.php?id=$1 [L] #prevent hotlinking RewriteCond %{HTTP_REFERER} !^http://(.+\.)?languageschoolsuk\.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://img251.imageshack.us/img251/4224/logovg.png [L] #compress php files to save bandwidth <ifModule mod_php4.c> php_value zlib.output_compression 16386 </ifModule> ErrorDocument 404 /404.php Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107239 Share on other sites More sharing options...
cags Posted September 4, 2010 Share Posted September 4, 2010 What do you get if you just use... ErrorDocument 404 "Darn" Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107240 Share on other sites More sharing options...
deansaddigh Posted September 4, 2010 Author Share Posted September 4, 2010 the page goes blank, unless i do it on the link i showed you. Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107241 Share on other sites More sharing options...
cags Posted September 4, 2010 Share Posted September 4, 2010 Playing around with different addresses on your server (handy it being live, most peoples aren't) it would seem that your host has set-up your server so that ErrorDocument cannot be set for files with a .php extension. I'm not entirely sure how or why this is done. But that is almost certainly the case. Is it shared hosting? You might need to contact them and find out why. Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107244 Share on other sites More sharing options...
deansaddigh Posted September 4, 2010 Author Share Posted September 4, 2010 Ahhh i see, thanks alot man, atleast i nkow now ill have to go and speak to them. Weird. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107249 Share on other sites More sharing options...
deansaddigh Posted September 4, 2010 Author Share Posted September 4, 2010 Sorry to post again, do you mean i cant specify a 404.php file in the htacess file? or that it wont redirect pagfes that are php on the site? Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107259 Share on other sites More sharing options...
cags Posted September 4, 2010 Share Posted September 4, 2010 I mean that URI requests to the server which end in a .php file extension will not trigger the ErrorDocument page, i.e. requests to something like... domain.com/blah.php ...won't trigger the error document, but ... domain.com/blah.foo ...will. Remember that although in your example you were requesting .htm, this is being rewritten to php. As I said I'm not entirely sure how they have done this, they must have something in their .conf files along the lines of... <files .*\.php> # disabled here </files> How exactly it's disabled though I'm not sure. Looking at the docs I can see that ErrorDocument overrides FileInfo, but so does mod_rewrite so they can't have disabled that. So unless they can set a default value, which isn't overridden I don't know (may have a look later out of morbid curiosity). Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107265 Share on other sites More sharing options...
deansaddigh Posted September 4, 2010 Author Share Posted September 4, 2010 Oh yeah i see, how very annoying. good news ive fixed it. basically in the control panel, they have custom error pages, so i just set the 404 error to be 404.php and it seems to have fixed it, maybe they have an overide function that overides htaccess . and you have to use there custom error pages in the control panel Thanks again man Quote Link to comment https://forums.phpfreaks.com/topic/212531-404-error-redirects/#findComment-1107266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.