Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect works but still shows 'file not found' error

         

wmmyg

5:23 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



I have a rewrite rule set up in an htaccess file which redirects fine, but it always causes a 'File does not exist' error in the logs.

I use links in emails to pass variables to index.cgi.

I use this format in the emails:
[mydomain.com...]

I use the 'go' directory to detect that the variables need to be passed to index.cgi

RewriteRule ^go/([0-9a-zA-Z]+)/([0-9]+)$ cgi-bin/index.cgi?t=$1&s=$2 [NC,L]

It redirects OK, but there is an error:
] tail /usr/local/apache/logs/error_log
File does not exist: /home/myuser/public_html/go/variable1

Can you please suggest changes that I can make in htaccess to stop the errors?

Many thanks in advance.

William

jdMorgan

11:14 pm on Jun 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is your rule in the very top-level .htaccess file?

If not, try modifying it to include the entire path to "/go" and try running it there. Some servers are configured to log the initial response code produced before mod_rewrite can execute in lower-level subdirectories. See the "%...s" and "%...>s" tokens in Apache mod_log_config [httpd.apache.org].

Jim

wmmyg

11:29 am on Jun 16, 2008 (gmt 0)

10+ Year Member



Thanks Jim.

However, as it turns out the error
'File does not exist: /home/myuser/public_html/go/variable1' had nothing to do with my htaccess setup after all.

I - eventually - discovered that the index.cgi script I am redirecting to was not finding an image file. The 'File does not exist' error from the missing image was being passed on to the redirect and it made it look like the problem was there.

Thanks for confirming that the basic syntax was ok, which made me look elsewhere.

William