如何在Firebase主机中实现.htaccess配置

问题描述:

我在我的域中配置了一个.htaccess配置,可以让我的应用程序与路由完美协同工作。它避免了刷新角度2应用程序无法解析路线时的错误。如何在Firebase主机中实现.htaccess配置

我现在的配置是一个部份

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# not rewrite css, js and images 
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png|php)$ [NC] 
RewriteRule ^(.*)$ /index.html?path=$1 [NC,L,QSA] 
</IfModule> 

我想实现我的火力地堡相同的配置主机,因为我迁移我的网站,我不知道如何从的.htaccess翻译成Firebase托管配置。

有没有简单的方法来做到这一点?

不能使用在Firebase hosting.htaccess,但可以配置它来重写,重定向,缓存等

了解如何customize hosting behavior这里。

.htaccess将被转换为

"hosting": { 
    "rewrites": [ { 
    "source": "**/!(*.css|*.js|*.map|*.jpg|*.gif|*.png|*.php)", 
    "destination": "/index.html" 
    } ] 
} 
+0

太谢谢你了。这完美的工作,现在我必须测试是否所有的.php文件都允许在域中写入。 – dreezyA