2017-08-28 54 views
1

我有这个代码在.htaccess项目:的.htaccess mod_rewrite的排除根

# If the requested filename exists, simply serve it. 
# We only want to let Apache serve files and not directories. 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule^- [L] 

# Rewrite all other queries to the front controller. 
RewriteRule^%{ENV:BASE}/app.php [L] 

所以现在每一个请求(除了明确的文件)发送到/app.php。

我想改变这种行为: 如果有人请求域没有任何进一步的文件或目录index.php应该显示。在所有其他情况下,应该执行给定的行为。

如何实现这一目标?

回答

1

要排除您可以使用以下条件的根文件夹

RewriteCond %{REQUEST_URI} !^/$ 

尝试:

RewriteCond %{REQUEST_URI} !^/$ 
RewriteRule^%{ENV:BASE}/app.php [L]