"File does not exist" in apache error log

25,322

Solution 1

You are trying to match a path that starts with a letter or number, but it starts with a '/'. Your rules should be something like

RewriteRule ^/([A-Za-z0-9-])/...$      ...

Alos, do you have access to the logs? If so, enable the logs for mog_rewrite

RewriteLog /some/path
RewriteLogLevel 3

Solution 2

If your Rewrite rules are in an .htaccess file, you need to have at least

AllowOverride FileInfo

in your apache configuration.

And you also need to have

Options FollowSymLinks

If your server configuration has

AllowOverride FileInfo Options

(or AllowOverride All) then you can also add Options FollowSymlinks to the .htaccess file.

Solution 3

There is a decent chance that the error doe not come from the page itself but rather from an element on the page.

Example: <img src="img/bla.jpg"/> would point to /female/dresses/img/bla.jpg instead of /img/bla.jpg.

Because the server first checks for the female folder when it's searching for the bla.jpg, it will never give the error on the element itself

Share:
25,322

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin almost 2 years

    This is an example of an error in out log file:

    File does not exist: /var/www/website/female, referer: http://www.example.com/female/dresses/A-Dress-Black

    /female does not physically exist, because we use friendly URLs via our .htaccess file which looks like this:

    RewriteEngine On # Turn on the rewriting engine
    RewriteBase /
    RewriteCond %{http_host} !^www.website.com$ [nc]
    RewriteRule ^(.*)$ http://www.website.com/$1 [r=301,nc,L]
    RewriteRule ^News/?$ news.php [NC,L]
    RewriteRule ^About/?$ about.php [NC,L]
    RewriteRule ^Contact/?$ contact.php [NC,L]
    RewriteRule ^Sign-In/Create-Account?$ sign_up_in.php [NC,L]
    RewriteRule ^Logout?$ sign_up_in.php?l=1 [NC,L]
    RewriteRule ^Your-Bag?$ your_bag.php [NC,L]
    RewriteRule ^Help?$ help.php [NC,L]
    RewriteRule ^Profile?$ profile.php [NC,L]
    RewriteRule ^Create-Profile?$ profile_create.php [NC,L]
    # ITEM
    RewriteRule ^([A-Za-z-]+)/([A-Za-z-]+)/([A-Za-z0-9-]+)/?$ store_focus.php?sex=$1catName=$2&permalink=$3 [NC,L]
    # PAGE
    RewriteRule ^([A-Za-z-]+)/([A-Za-z-]+)/page/([0-9]+)/?$ store.php?sex=$1&catName=$2&page=$3 [NC,L]
    # CATEGORY
    RewriteRule ^([A-Za-z-]+)/([A-Za-z-]+)/?$ store.php?sex=$1&catName=$2 [NC,L]
    # SEX
    RewriteRule ^([A-Za-z-]+)/?$ store.php?sex=$1 [NC,L]
    

    Every request for a page results in an error even though the site works fine. Has anyone encountered this before?

    • Admin
      Admin over 13 years
      I still haven't got to the bottom of this... really annoying!
    • LazyOne
      LazyOne almost 13 years
      Asked April 2010 .. Last answer Feb 2011, OP's last comment dated March 2011 .. and still no solution? Doh. 1) There is missing & in ITEM rule: store_focus.php?sex=$1catName= should be store_focus.php?sex=$1&catName= 2) Individual pages rewrite rules have missing / before ?: ^Profile?$ should be ^Profile/?$
  • Admin
    Admin about 14 years
    Hmm, that's not it. The hyphen can be anywhere outside of a range, unescaped.
  • Admin
    Admin about 14 years
    Sometimes the log just looks like this: [Wed Apr 14 15:18:37 2010] [error] [client 81.138.14.83] File does not exist: /var/www/website/female
  • Admin
    Admin about 14 years
    so you think it should be RewriteRule ^/([A-Z......... ?
  • Admin
    Admin about 14 years
    Unfortunately It gives me an error when I add a "/". Do you really need the "/" if you have RewriteBase = "/" ---- The requested URL /female/just-arrived/page/1 was not found on this server.
  • Admin
    Admin about 14 years
    I do not think RewriteBase does what you think... Try remove it.
  • Admin
    Admin about 14 years
    No difference, damn!
  • Admin
    Admin about 14 years
    Edited my answer with more ideas
  • Admin
    Admin about 14 years
    Ah good idea.. didn't realise you could log rewrites. I've got the log here: 79.125.18.68/rwlog.txt Just trying to make some sense of it.
  • Admin
    Admin about 14 years
    From the log, it seems to be working. Do you still have problems?
  • Admin
    Admin about 14 years
    We don't have any problems per se, just entries in the log saying it thinks there are problems!
  • Admin
    Admin over 13 years
    I don't use .htacces..All options are set in the VHost.
  • francadaval
    francadaval almost 11 years
    Thank you! I had the same problem and in my case it was because the web browser was searching for the favincon.png file with a relative path.
  • MrWhite
    MrWhite over 3 years
    The OP has stated that "the site works fine", so the .htaccess rules must already be working satisfactorily. If the problem was to do with AllowOverride or Options then the site wouldn't work at all.
  • MrWhite
    MrWhite over 3 years
    "There is a decent chance that the error doe not come from the page itself" - although the URL quoted in the error log would seem to be the "page itself"?
  • MrWhite
    MrWhite over 3 years
    "The hyphen can be anywhere outside of a range, unescaped." - yes, at the start or end of the character class.
  • MrWhite
    MrWhite over 3 years
    "so you think it should be RewriteRule ^/([A-Z......... ?" - No, the RewriteRule pattern should only be prefixed with / (ie. root-relative) if the directive is used in a server or virtualhost context, not .htaccess.
  • MrWhite
    MrWhite over 3 years
    "...but it starts with a /" - The URL-path that the RewriteRule pattern matches against does not start with a slash when used in .htaccess (directory context). That would only apply if the directives are being used directly in a server or virtualhost context (which does not apply here).