.htaccess problem

Anagoge

Senior Member
I'm trying to use .htaccess to create a custom 404 page but it's not working. I've got this in it currently:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.theworkof\.co\.uk [nc]
RewriteRule ^(.*)$ http://www.theworkof.co.uk/$1 [R=301,L]
ErrorDocument 404 404.html
ErrorDocument 500 404.html

Is it because of the rewrite commands? I've tried using "/404.html" too.

The Work Of Neil Martin - The sky's the limit... is the link to the error page. http://www.theworkof.co.uk/fakepage.html link to nonexistant page, which results in a 500 Internal Server Error.

Thanks for the help.
 
All I do when I have a custom 404 page is name it 404.shtml and upload it to the root of the live domain directory.
 
I'm really not too sure. I did it, left it, not too bothered as it wasn't too important, and a couple of hours later it registered it as there. Did that for me three or four times.
 
Yeah, I guess.
I'm thinking it's just the server registering the new 404 and deleting the old one. Could be totally wrong tho.
 
yo Anagoge


try the following....

Copy the code below to a text file and upload it to your server. Then rename the file to ".htaccess"
minus the quote marks.

ErrorDocument 404 404.html
ErrorDocument 500 404.html


Make sure that 404.html resides within the same directory as your .htaccess file other wise use

ErrorDocument 404 /404.html

so that the file requested will be found from the top level root directory.

If this doesn't work its like to be the config of your hosting environment, send them a support ticket.

Regards

Geoff

PS. it will be instant if it works as this is not a DNS / propagation, only way it may appear to be delayed is if your hosting provider/isp is running any form of data caching.
 
good you could help Sunburn.

My server is rather retarded to say the least, so that's why I told Anagoge what I said. I haven't familiarised myself properly with .htaccess codings yet, so I couldn't give an accurate answer
 
Strange, I've just looked at my directory listing and .htaccess isn't there. I tried to upload it again and it still wasn't there. Do you think my server is automatically deleting the file?
 
no, a .htaccess file is a hidden file. save it on a mac and you'll see, it says 'save as .htaccess? this will hide the file from public view'
 
I think I found the bug...


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.theworkof\.co\.uk [nc]
RewriteRule ^(.*)$ http://www.theworkof.co.uk/$1 [R=301,L]
ErrorDocument 404 /404.shtml
ErrorDocument 500 /404.shtml
 
Adding .shtml unfortunately didn't solve the problem and neither did adding the forward slashes. I'm guessing this has to be a server-side problem because I can't think of anything else I can do. I've tried removing the mod rewrites and just having the ErrorDocuments and that didn't work either. :(
 
I've figured out the problem with the help of someone. It was because the .txt was still appended to the file. Thanks for the help, though.
 
Back
Top