You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Erez Segal <se...@gmail.com> on 2007/04/27 07:14:01 UTC

[users@httpd] Mod rewrite F flag

In my server, I want to reject access to files that exist. (to some php
files that are allways included via other files, and never needs to be
accessed directly).
I use:
RewriteRule ^(.*)$ - [F]
The trouble is it sends 403 - forbidden.
I want it to send 404 - file not found.
how can this be done?

Thanks in advance.
  Erez.

Re: [users@httpd] Mod rewrite F flag

Posted by Joshua Slive <jo...@slive.ca>.
On 4/27/07, Erez Segal <se...@gmail.com> wrote:
>
> In my server, I want to reject access to files that exist. (to some php
> files that are allways included via other files, and never needs to be
> accessed directly).
> I use:
> RewriteRule ^(.*)$ - [F]
> The trouble is it sends 403 - forbidden.
> I want it to send 404 - file not found.
> how can this be done?

You can try replacing [F] with [R=404]. I believe that works in some
recent versions of apache, but I'm not sure. Otherwise, you can get
rid of the [F] and simply point the RewriteRule at a non-existing
file. And finally, you can use
ErrorDocument 403 /path/to/errorscript.cgi
where errorscript.cgi sends Status: 404.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org