Search code examples
phpurl-rewritingapache2wamplamp

Strange behaviour between wamp and lamp (ubuntu)


Ever since I moved to Linux, I noted some strange behaviour. In Ubuntu, http://localhost/index works but on WAMP it does not work. I tested this with APACHE's rewrite module set to off on both. Any good explanation? Strange WAMP & LAM behavior

Apache.conf (LAMP)

etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

Apache.conf WAMP

<Directory "C:/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all

</Directory>

EDIT: Why it behaves this way thanks to [tntu][2]

Because of the directive Options Indexes FollowSymLinks MultiViews on LAMP (ubuntu), the url localhost/index can resolve to the file index.php, index.html. So foo would also result into foo.php, foo.html. A proper explanation can be derived from http://httpd.apache.org/docs/current/content-negotiation.html

Don't be confused to think this is url rewriting


Solution

  • It is because of this option in Apache Conf:

    Options FollowSymLinks