[Resolved] custom 404 page is not working
I have read all the instructions provided for how to create a 404 page, I’ve read all through the forums. They all say to add this to .htaccess:
ErrorDocument 404 /index.php?error=404
I have done this in mine, at the very top of the .htaccess file, with nothing else around it, before the #BEGIN lines.
Oh, and you’ve got that nasty Microsoftian default error page.
This might be a dumb question, but are you certain your host supports custom .htaccess? I noticed you aren’t using mod_rewrite — that’s the only reason you ask.
If they do allow custom .htaccess and mod_rewrite (which most hosts do), then just let WordPress handle it — enabling the “pretty” permalink structure will give WordPress power enough to return a 404 if it doesn’t find a match for something.
What you need is a file in your theme folder with the name 404.php, which will be what WordPress serves whenever a request is made that it can’t fine.
The technique you have above is to force any 404 error the Apache server receives to be sent to your WordPress 404 template. Which is fine, but you need to create that template file with what you want it to say.
Since you don’t have a 404.php template, the next default is the index.php template in your theme folder, which shouldn’t be confused with many other index.php files.
It doesn’t matter if you have permalinks set or not, although they do solve the need for your above code because every file request will be sent to WordPress anyhow, and it would determine if a 404 is warranted or not. Right now http://www.sogroovynow.com/?psf=48908940sdfd will be handled by a WordPress 404 while http://www.sogroovynow.com/errorerror will be handled by whatever file Apache says to point to for a 404, which I assume you set to that lovely Microsoftian page until you figure this out.
And I’m curious, what’s the font you use in your title images?
my server said that they have given me the correct permissions to my .htaccess file, and I can edit it. I cannot change the permissions myself – they have to do it. which sucks.
From what I am reading on all the forums & in the codex, when I change my permalink structure (for ex., from default to “pretty”), there should be some kind of automatic change to my .htaccess, correct? But nothing EVER changes when I change my permalink structure in that file.
Oh yea…I had to create that file myself because my server responded when I asked where it was: ‘Kindly note that your domain is hosted on a windows servers and we do not support all the functions of the ‘.htaccess’ file on it.’ So, I created it and they set the permissions for me. The only time anything was written to it was when I activated the FAlbum plugin. (which isn’t working correctly, either)
I do have a custom 404 page in both my themes.
I am very frustrated. I think I need a new host. It appears all the problems I am having (changing permalinks, plug-ins not working, 404 not working) all point to them. When I asked for help on a plug-in, it’s writer said something about ‘websites hosted on Windows.’
And one last thing, I was reading one of the forums and it told me to check with my host to see if they allow URL rewrite (when I was trying to change permalinks). They emailed me back and told me that I can “redirect.”
Any help is appreciated, I hate to change hosts just simply because of the chore of moving everything over. My host is super cheap and I guess that explains my problems.
The font I use is fontdinerdotcom sparkly. There is also a fontdinerdotcom font. They are free fonts available at fontdiner.com – go to their website, enter it, at the bottom menu on the ‘radio’ click free silverware. They have some GREAT free retro fonts available.
Thanks for all your help.
All these problems point to hosting on windows. It just won’t do things the way you’d hope.
I don’t expect your host will enable you to point 404 errors to your own file, which will be WordPress, and I’m not sure why WordPress 404s would still look like your index.php template if you have a 404 template.
I’m a bit confused why you have a Windows 404 at this page: http://www.sogroovynow.com/index.php?error=404
And thanks for the tip on the font. Much appreciated.
I think I’ve solved this problem – I have a new host now. I just changed my permalink structure with no problem, it did create information in the .htaccess file.
AND my custom 404 page is working, also.
I had to pay for a year’s worth of hosting (yikes) to get them at a good price, but so far all the changes I’ve made are working. Thsnk for your help.
- The topic ‘[Resolved] custom 404 page is not working’ is closed to new replies.