0

After search around and dont get it working as desired, I will try the luck asking here.

I have enabled mod_info.c on my Apache webserver. I can restrict the access using for example:

<Location /server-info>

    SetHandler server-info
    Require ip XXX.XXX.XXX.XXX

</Location>

This works, but, since I have many Virtual Hosts on same IP, all they can try access and get the error 403 - Forbidden.

This is not the problem.

My question is about how to change the 403 - Forbidden to 404 - Not Found.

This way, all badbots, scans, etc... Will think the mod is not enable, and I still can use it for specific IP or domain...

Seems Rewrite Engine inside of mod_info conf file does not allow it, example:

<Location /server-info>

    SetHandler server-info

    RewriteCond %{HTTP_HOST} !^myprivatedomain.local$ [NC]
    RewriteRule ^ - [L,R=404]

    Require ip XXX.XXX.XXX.XXX
</Location>

The code above does not return the 404 error as desired.

Someone would give me an hint about how to archive the desired goal?

Goal:

Redirect all virtual hosts and web access to 404 when looking for /server-info except for myprivatedomain.local the one I will use internally.

Wisdom
  • 121
  • 1
  • 1
  • 13
  • 1
    How about this https://stackoverflow.com/questions/2447106/redirect-to-apache-built-in-404-page-with-mod-rewrite – jasondayee Dec 16 '19 at 07:07
  • Your link point me why this never will happen, the comments from apache documentation says: However, if a status code is outside the redirect range (300-399) then the substitution string is dropped entirely, and rewriting is stopped as if the L were used. I see the option about make an page for 404 and use it, but since is many domains, and some of those I can not change, I will try look to another solution then. Thanks for help!!! – Wisdom Dec 16 '19 at 07:20

0 Answers0