Symfony 3 .htaccess mod_alias后备解释

时间:2016-05-07 23:43:00

标签: apache .htaccess symfony

我查看了Symfony 3 .htaccess文件,发现了这个:

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>

有人可以解释一下这个RedirectMatch指令的用处,因为我似乎无法得到它。如果mod_rewrite未启用,我将请求http://localhost/myproject/web/,甚至不会触发因为^/$URL-path匹配,在这种情况下为/myproject/web/ ... < / p>

当应用程序驻留在文档根目录内而不是像在本地开发时通常那样在子目录中时,这个回退是否仅在生产中有用?

它是如何运作的?

0 个答案:

没有答案