title: Symfony4 Assets handle after deployment
body: <p>I just tried to deploy my app on a server and I have some problems wiht the assets.</p>
  
  <p>I uploaded my app on a subfolder <code>rapp</code> so I have this <code>/var/www/html/rapp</code></p>
  
  <p>First : I had to change my publicPath on webpackEncore to include <code>/rapp/public</code> to have <code>/rapp/public/build</code> while just <code>/build</code> worked in dev (with the <code>php bin/console server:run</code> command)
  is there a way to keep the publicPath inside the public Folder ? why I have to specify the subfolder ?</p>
  
  <p>Second, with the first change It seems I have good URL to get my assets <code>http://domain/rapp/public/build/main.css</code> but it return a 404 for all my assets file (js and css)
  I followed the recommended VHost (changed for some tests)</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      #ServerName domain.tld
      #ServerAlias www.domain.tld
  
      DocumentRoot /var/www/html/rapp/public
      &lt;Directory /var/www/html/rapp/public&gt;
          AllowOverride All
          Order Allow,Deny
          Allow from All
      &lt;/Directory&gt;
  
      # uncomment the following lines if you install assets as symlinks
      # or run into problems when compiling LESS/Sass/CoffeeScript assets
      # &lt;Directory /var/www/project&gt;
      #     Options FollowSymlinks
      # &lt;/Directory&gt;
  
      ErrorLog /var/log/apache2/project_error.log
      CustomLog /var/log/apache2/project_access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>edit : added .htaccess on my root app folder and public app folder
  root app folder:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L]
      RewriteCond %{REQUEST_URI} !^/public/
      RewriteRule ^(.*)$ public/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>and public app folder</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  
      RewriteEngine On
      RewriteBase /rapp/
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php [QSA,L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>and here is my webpack encore config</p>
  
  <pre><code>// webpack.config.js
  var Encore = require('@symfony/webpack-encore');
  
  Encore
  // the project directory where all compiled assets will be stored
      .setOutputPath('public/build/')
  
      // the public path used by the web server to access the previous directory
      .setPublicPath('/rapp/public/build')
  
      // will create public/build/main.js and public/build/main.css
      .addEntry('main', './assets/js/main.js')
      //Add entry if other js/css needed. first parameter is the generated filename.
      .addEntry('reader', './assets/js/reader.js')
  
      //file upload with dropzone
      .addEntry('dropzone', './assets/js/dropzone.js')
  
      //Admin chapter js
      .addEntry('admin-chapter', './assets/js/chapter.js')
  
      // allow sass/scss files to be processed
      .enableSassLoader()
  
      // allow legacy applications to use $/jQuery as a global variable
      .autoProvidejQuery()
  
      .enableSourceMaps(!Encore.isProduction())
  
      // empty the outputPath dir before each build
      .cleanupOutputBeforeBuild()
  
  // create hashed filenames (e.g. app.abc123.css)
      .enableVersioning()
  
      .createSharedEntry('vendor', [
          'jquery',
      ])
  
      .configureFilenames({
          images: '[path][name].[hash:8].[ext]'
      })
  ;
  
  // export the final configuration
  module.exports = Encore.getWebpackConfig();
  </code></pre>
  
  <p>(I launched the Encore build with dev option, not production)</p>
  
  <p>the manifest.json is created, all the files with versioning are created, but as the file request is without versionning, it seems it's not found.</p>
  
  <p>I just started with webpack with this project so i'm a complete noob, and I don't know much about apache/htaccess config, so maybe I miss something obvious...</p>
  
  <p>If I'm unclear with something, let me know it's quite late here and I can't think properly anymore ^^"</p>
  
  <p>edit : I changed my vhost config (on a conf file : <code>/etc/apache2/sites-enabled/rapp.conf</code>) and htaccess on my app folders (root and public)
  I still not working though.</p>