Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess problem

Discussion in 'Website Design Forum:' started by Anagoge, Jan 3, 2009.

  1. Anagoge

    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.
     
  2. tim

    tim Senior Member

    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.
     
  3. Anagoge

    Anagoge Senior Member

    I've tried uploading 404.shtml and 500.shtml but that didn't work either.
     
  4. tim

    tim Senior Member

    I don't think it does it instantly.
     
  5. Anagoge

    Anagoge Senior Member

    Why would it not do it instantly? Just curious.
     
  6. tim

    tim Senior Member

    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.
     
  7. Anagoge

    Anagoge Senior Member

    So you're saying it's a propagation issue?
     
  8. tim

    tim Senior Member

    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.
     
  9. Sunburn

    Sunburn Active Member

    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.
     
  10. tim

    tim Senior Member

    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
     
  11. Anagoge

    Anagoge Senior Member

    Thank you for the advice, Sunburn, but I've already done everything you've suggested.
     
  12. Anagoge

    Anagoge Senior Member

    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?
     
  13. tim

    tim Senior Member

    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'
     
  14. Anagoge

    Anagoge Senior Member

    I don't know what else to try.
     
  15. tim

    tim Senior Member

    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
     
  16. tim

    tim Senior Member

  17. Anagoge

    Anagoge Senior Member

    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. :(
     
  18. tim

    tim Senior Member

    that's really confusing.
     
  19. Greg

    Greg Active Member

    Hi Neil,

    What type of server is your site hosted on? Windows, Linux or ColdFusion?

    Greg
     
  20. Anagoge

    Anagoge Senior Member

    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.
     

Share This Page