RE: [users@httpd] force 404 error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can put RewriteCond/RewriteRule inside 
server config, virtual host, directory, .htaccess
see 
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond


You don't need the DirectoryMatch because the same thing makes RewriteCond for you.

REQUEST_URI is the part after host:port
e.g "www.example.com:8000/dir1/dir2/.svn" the "/dir1/dir2/.svn"-part 

  RewriteCond %{REQUEST_URI} ^(.*)/.svn(.*)$
  RewriteRule ^(.*)$ /errors/404.html

This should do the trick to rewrite all ".svn" which could be in any URI.

bye
Oli

-----Ursprüngliche Nachricht-----
Von: Uk1ah Sm1th [mailto:ukiah@xxxxxxxxxxxxx]
Gesendet: Mi 15.02.2006 18:04
An: users@xxxxxxxxxxxxxxxx
Betreff: Re: [users@httpd] force 404 error
 
On Wed, Feb 15, 2006 at 05:38:05PM +0100, Oliver.Schaudt@xxxxxxxxx wrote:
> >Right now they return 403 forbiden
> In your first post you talked of a HTTP_FORBIDDEN (403) not from a HTTP_OK (200)

Sorry about the confusion. I currently have the .svn directorys set as
forbidden.

> 
> With
>   ErrorDocument 403 404.html
> you send each user which gets a HTTP_FORBIDDEN (403) your HTTP_NOT_FOUND page
> 
> > I am looking for a way to change a http response from 200 to 404
> This is new and cannot be covered alone by the thing above
> 
> Here should help a RewriteRule and a RewriteCond in a manner like this
>   
>   RewriteRule ^(.*)$ 404.html
> 
> Oli

I thinks this is what I'm looking for. Could it be put inside a
DirectoryMatch item?

<DirectoryMatch "^/.*/\.svn/">
   RewriteCond .*
   RewriteRule ^(.*)$ /errors/404.html
</DirectoryMatch>

thanks again.

> 
> -----Urspr?ngliche Nachricht-----
> Von: Uk1ah Sm1th [mailto:ukiah@xxxxxxxxxxxxx]
> Gesendet: Mi 15.02.2006 17:20
> An: users@xxxxxxxxxxxxxxxx
> Betreff: Re: [users@httpd] force 404 error
>  
> On Wed, Feb 15, 2006 at 04:54:51PM +0100, Oliver.Schaudt@xxxxxxxxx wrote:
> >  ErrorDocument 403 /path/to/errorfile/404.html 
> > see
> >  http://httpd.apache.org/docs/2.0/custom-error.html
> > 
> > bye
> 
> I am not looking for how to make custom error pages. I am looking for a
> way to change a http response from 200 to 404. I have some directorys
> that exist on my server, .svn directorys. When a user types in
> http://example.com/.svn the NORMALLY get a 200 response and the file.
> This is because the .svn directory is there and readable. I want a
> user to recieve a 404 file not found INSTEAD of the 200, without me
> having to manually delete the .svn directorys.
> 
> I don't want users to even know that the .svn directorys exist.
> 
> Thanks .U
> 
> -- 
> "Well done is better than well said."
>              - Benjamin Franklin (1706-1790)
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 


> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

-- 
"Well done is better than well said."
             - Benjamin Franklin (1706-1790)

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


<<winmail.dat>>

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux