Apache2 and /icons path behaving differently

6,491

Solution 1

in your httpd.conf you have something like

Alias /icons /path/to/icon/dir

Solution 2

Apache2 comes out of the box with an alias mod file enabled at this location:

/etc/apache2/mods-available/alias.conf

and this is the content of that file

<IfModule alias_module>
        # Aliases: Add here as many aliases as you need (with no limit). The format is
        # Alias fakename realname
        #
        # Note that if you include a trailing / on fakename then the server will
        # require it to be present in the URL.  So "/icons" isn't aliased in this
        # example, only "/icons/".  If the fakename is slash-terminated, then the
        # realname must also be slash terminated, and if the fakename omits the
        # trailing slash, the realname must also omit it.
        #
        # We include the /icons/ alias for FancyIndexed directory listings.  If
        # you do not use FancyIndexing, you may comment this out.

        Alias /icons/ "/usr/share/apache2/icons/"

        <Directory "/usr/share/apache2/icons">
                Options FollowSymlinks
                AllowOverride None
                Require all granted
        </Directory>

</IfModule>

So you can remove the sym link at

/etc/apache2/mods-enabled/alias.conf

to disable the behavior.

Share:
6,491

Related videos on Youtube

masegaloeh
Author by

masegaloeh

Updated on September 17, 2022

Comments

  • masegaloeh
    masegaloeh over 1 year

    My site is written in asp.net using mono and apache under ubuntu LTS.

    After debugging most of the problems out I still had problems with my icon folder icons. It was giving me the wrong or no icon. Then I notice /blah gets me my custom 404 page while /icons gets me a directory listing.

    Why is /icons/ path hitting a directory instead of using my asp.net code? No other path that I know of (ATM) does that.

    Side note: /images/ also exist in the same directory as my icons folder. /images/ does not cause a directory listing either.

  • lg.
    lg. almost 14 years
    And... Directory ...Options Indexes
  • leticia
    leticia almost 14 years
    it was in /etc/apache2/mods-enabled/alias.conf
  • Admin
    Admin almost 7 years
    f apache and my 7 year old question. I'm having a fantastic time with nginx
  • Admin
    Admin almost 2 years
    Yea, I prefer my newer NodeJS servers. But it doesn't make sense to move legacy apps from Apache to Nginx right now. Apache works.