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
there is answer in github issue
Put .htaccess in src folder (final path for is
src/.htaccess
)Add it to
angular-cli.json
in the assets array (like favicon.ico).Have something similar to this:
"assets": [ "assets", "assets/images/favicon.ico", ".htaccess" ],
By having .htaccess
outside the src
, you'll most likely to get the following error,
An unhandled exception occurred: The .htaccess asset path must start with the project source root.
The corrected approach is this,
"assets": [
"src/favicon.ico",
"src/assets",
"src/.htaccess"
],
...
Make sure to put your .htaccess
file under src
.
With the above settings, when you run your build
, you'll get the .htaccess
inside the dist
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With