"File does not exist" in apache error log
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
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 17, 2022Comments
-
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 over 13 yearsI still haven't got to the bottom of this... really annoying!
-
LazyOne almost 13 yearsAsked 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 bestore_focus.php?sex=$1&catName=
2) Individual pages rewrite rules have missing/
before?
:^Profile?$
should be^Profile/?$
-
-
Admin about 14 yearsHmm, that's not it. The hyphen can be anywhere outside of a range, unescaped.
-
Admin about 14 yearsSometimes 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 about 14 yearsso you think it should be RewriteRule ^/([A-Z......... ?
-
Admin about 14 yearsUnfortunately 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 about 14 yearsI do not think RewriteBase does what you think... Try remove it.
-
Admin about 14 yearsNo difference, damn!
-
Admin about 14 yearsEdited my answer with more ideas
-
Admin about 14 yearsAh 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 about 14 yearsFrom the log, it seems to be working. Do you still have problems?
-
Admin about 14 yearsWe don't have any problems per se, just entries in the log saying it thinks there are problems!
-
Admin over 13 yearsI don't use .htacces..All options are set in the VHost.
-
francadaval almost 11 yearsThank 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 over 3 yearsThe OP has stated that "the site works fine", so the
.htaccess
rules must already be working satisfactorily. If the problem was to do withAllowOverride
orOptions
then the site wouldn't work at all. -
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 over 3 years"The hyphen can be anywhere outside of a range, unescaped." - yes, at the start or end of the character class.
-
MrWhite over 3 years"so you think it should be
RewriteRule ^/([A-Z.........
?" - No, theRewriteRule
pattern should only be prefixed with/
(ie. root-relative) if the directive is used in a server or virtualhost context, not.htaccess
. -
MrWhite over 3 years"...but it starts with a
/
" - The URL-path that theRewriteRule
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).