Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:31:51+00:00 2026-06-15T15:31:51+00:00

At the moment we are using a .htaccess rule for user avatars, if they

  • 0

At the moment we are using a .htaccess rule for user avatars, if they have not uploaded an avatar then a 404 occurs and shows a default avatar image.

However this happens thousands of times a day and the error_log is pretty much constantly being written to.

The .htaccess rule is in the /avatar/ directory which only consists of the image files.

PHP image code

<img src="/avatar/<?=$userId?>.png" />

.htaccess code used in the images directory

ErrorDocument 404 /unknown.gif

Is there any other fast way I could do this to stop the 404 error occuring or mabye even being logged?

Would a php.ini file in the /avatar/ directory that turned off error reporting work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:31:52+00:00Added an answer on June 15, 2026 at 3:31 pm

    Simple. Only display the image, if the image exists.

    <?php
    
    if(file_exists("/avatar/" . $userId . ".png")) {
        print('<img src="/avatar/' . $userId . '.png" />');
    }
    else {
        print('<img src="/avatar/unknown.gif" />');
    }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment using .htaccess in my PHP Application to choose which page I'm
At the moment am using JOGL for a ball detection program I have been
I am building a cms at the moment using the zend framework and have
I have a Java client that calls a web service at the moment using
I'm at the moment using the PHP money_format() function , and have money_format('%.0i', $row['price'])
I have a large scale project I am working on at the moment using
I'm learning c++ and at the moment though using Qt creator. I have heard
I'm using the standard Zend /public/.htaccess file (shown below). At the moment I'm attempting
I have Apache and PHP setup and i am using a .htaccess file to
At the moment I'm using bat file to launch my jar and set the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.