“File does not exist” in Apache error log when mod_rewrite is using

6,256

Solution 1

I ran into a similar situation yesterday. My website was working fin, but there were errors in Apache's error log. The problem was caused by a mistake in my PHP files, not in my RewriteRule.

My PHP files contained the following fragment:

<script src="javascript/package-min-1367246122.js"></script>

The missing slash caused "file does not exist" errors in Apache's error log. This the correct fragment:

<script src="/javascript/package-min-1367246122.js"></script>

Solution 2

You may have used a , in some <img> tag. For example:

<img src="/testing/flats-in-delhi-for-sale,">
<script src="/testing/flats-in-delhi-for-sale,"></script>

Don't forget that the URL is very sensitive to any character.

Share:
6,256

Related videos on Youtube

Cosmosis
Author by

Cosmosis

Updated on September 18, 2022

Comments

  • Cosmosis
    Cosmosis over 1 year

    I am getting below error in server log, when re-writing the URLs.

    [Fri Jan 25 11:32:57 2013] [error] [client ***IP***] File does not exist: /home/testserver/public_html/testing/flats-in-delhi-for-sale, referer: http://domain.in/testing/flats-in-delhi-for-sale/
    

    I searched very where, but not found any solution.

    My .htaccess config is given below:

    Options +FollowSymLinks
    Options All -Indexes
    
    ErrorDocument 404 http://domain.in/testing/404.php
    
    RewriteEngine On
    
    #Category Link
    RewriteRule ^([a-zA-Z]+)-in-([a-zA-Z]+)-([a-zA-Z-]+)/?$ view-category.php?type=$1&dis=$2&cat=$3 [NC,L]
    
    #Single Property Link
    RewriteRule ^([a-zA-Z]+)-in-([a-zA-Z]+)-([a-zA-Z-]+)/([a-zA-Z0-9-]+)/?$ view-property.php?type=$1&district=$2&category=$3&title_alias=$4 [NC,L]
    

    I also found similar old dated question, but no answer ("File does not exist" in apache error log).

    Thanks in advance for your help.

    P.S.: My site is working fine even Apache log is showing the error.

  • Cosmosis
    Cosmosis about 11 years
    Thanks for your reply. My site is working fine even Apache log is showing the error.