question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng build fails to copy .htaccess to dist folder

See original GitHub issue

ng build does not copy .htaccess to dest dir. I have tried to put .htaccess in both src and src/assets folder but in both cases .htaccess does not appears in dist folder.
Here are more details about:

OS?

Linux Mint 18.1 “Serena”

Versions.

angular-cli: 1.0.0-beta.28.3 node: 7.5.0 os: linux x64 @angular/common: 2.4.7 @angular/compiler: 2.4.7 @angular/core: 2.4.7 @angular/forms: 2.4.7 @angular/http: 2.4.7 @angular/platform-browser: 2.4.7 @angular/platform-browser-dynamic: 2.4.7 @angular/router: 3.4.7 @angular/compiler-cli: 2.4.7

Repro steps.

ng new angular-cli-test cp kibernum-dnc-client/src/.htaccess angular-cli-test/src/ cd angular-cli-test

ng build ls -la dist/

mv src/.htaccess src/assets/ ng build ls -la dist/

The log given by the failure.

There is no log error. Errror is that I expect that file .htaccess is copied in dist folder.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

53reactions
filipesilvacommented, Feb 10, 2017

When you put it in src/assets/.htaccess, it will be copied into dist/assets/.htaccess.

If you want it to be in dist/.htaccess, then you should be in src/.htaccess AND you need to add it to angular-cli.json in the assets array (like favicon.ico).

18reactions
filipesilvacommented, Feb 10, 2017

Change this bit:

      "assets": [
        "assets",
        "favicon.ico"
      ],

to

      "assets": [
        "assets",
        "favicon.ico",
        ".htaccess"
      ],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to deploy Angular 5 using dist folder in WAMP server
Steps to produce dist folder : step 1 - ng build --prod --base-href "/dist/". step 2 : Copy the dist/* files to DOCUMENT_ROOT....
Read more >
Deployment - Angular
On the first terminal, run the ng build command in watch mode to compile the application to the dist folder. ng build --watch....
Read more >
How to Deploy an Angular App (Angular 4)
When you run the ng build command, it creates a /dist folder. Here are the files and their associated sizes after running the...
Read more >
Simple deployment options - Angular - w3resource
Start with the production build: ng build --prod; Copy everything within the output folder (dist/ by default) to a folder on the server....
Read more >
Dockerizing an Angular App - Michael Herman
This will speed up the Docker build process as our local ... RUN ng e2e --port 4202 # generate build RUN ng build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found