wamp和lamp之间的奇怪行为(ubuntu)

时间:2013-11-28 02:49:02

标签: php url-rewriting apache2 wamp lamp

自从我搬到Linux后,我注意到了一些奇怪的行为。在Ubuntu中,http://localhost/index可以正常工作但在WAMP上它不起作用。 我测试了这个,APACHE的重写模块设置为关闭。有什么好解释吗? Strange WAMP & LAM behavior

Apache.conf(LAMP)

等/ apache2的/网站启用/ 000-默认

<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>

编辑:由于[tntu] [2]

,为什么它会以这种方式运行

由于LAMP(ubuntu)上的指令Options Indexes FollowSymLinks MultiViews,url localhost / index可以解析为index.php,index.html文件。所以foo也会导致foo.php,foo.html。可以从http://httpd.apache.org/docs/current/content-negotiation.html

中获得正确的解释

不要混淆认为这是url重写

2 个答案:

答案 0 :(得分:1)

您确定 apache.conf 文件和站点配置文件是否相同?

从它的外观来看,一个 DirectoryIndex index.php ,而另一个索引 DirectoryIndex 。有关 DirectoryIndex 的详细信息,请参阅http://httpd.apache.org/docs/2.2/mod/mod_dir.html

答案 1 :(得分:0)

这是因为Apache Conf中的这个选项:

Options FollowSymLinks