在angular 4 cli项目中的何处添加htaccess文件以添加重写规则? [英] where to add htaccess file in angular 4 cli project to add rewrite rules?

查看:103
本文介绍了在angular 4 cli项目中的何处添加htaccess文件以添加重写规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了角度项目.现在我想完全使用htaccess file更改一些url格式强制.所以我应该把htaccess文件放在哪里? 我已经尝试过像下面这样的路径:

I have completed angular project. now i want to change some url format force fully using htaccess file.so where should i put htaccess file? I have tried everywhere like belows path:

/opt/lampp/htdocs/GreatColoradoHomes
/opt/lampp/htdocs/GreatColoradoHomes/src
/opt/lampp/htdocs/GreatColoradoHomes/src/app

推荐答案

在github中有答案问题

there is answer in github issue

将.htaccess放入src文件夹(最终路径为src/.htaccess)

将其添加到资产数组(例如favicon.ico)的angular-cli.json中.

Add it to angular-cli.json in the assets array (like favicon.ico).

具有与此类似的内容:
"assets": [ "assets", "assets/images/favicon.ico", ".htaccess" ],

Have something similar to this:
"assets": [ "assets", "assets/images/favicon.ico", ".htaccess" ],

这篇关于在angular 4 cli项目中的何处添加htaccess文件以添加重写规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆