# Startup VPI
## Routes
### Ou est-ce qu'on peut configurer Apache ?
1. `apache2.conf`
2. VirtualHost (/etc/apache2/site-available qui fait des liens symboliques vers /etc/apache2/site-enabled et qui permet d'utiliser les commandes a2ensite et a2dissite)
3. `.htaccess`
### .htaccess
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^(.*)$ index.php [QSA,L]
```
1. `RewriteCond %{REQUEST_FILENAME} !-f`
Cette règle signifie que la condition est appliquée que si le fichier appelé n'existe pas.
3. `[NC]`
* 'nocase|NC' (no case)
This makes the test case-insensitive - differences between 'A-Z' and 'a-z' are ignored, both in the expanded TestString and the CondPattern. This flag is effective only for comparisons between TestString and CondPattern. It has no effect on filesystem and subrequest checks. (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_nc)
4. `RewriteRule ^(.*)$ index.php [QSA,L]`
* When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined. (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa)
* The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. This corresponds to the last command in Perl, or the break command in C. Use this flag to indicate that the current rule should be applied immediately without considering further rules. (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_l)