racourcir l'URL de base d'accès
Bonjour,
Je souhaiterais avoir un URL propre sans app.php mais j'arrive pas avec cette conf
dans la racine du site j'ai créer un fichier .htaccess j'ai rajouter cela
Code:
1 2 3 4 5
| <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule> |
mon autre fichier .htaccess qui se trouver dans le répertoire web
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule> |
configuration apache
Code:
1 2 3 4 5 6
| <Directory /var/www/Symfony/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Allow from All
</Directory> |
quand j’accède a localhost il me redirige vers localhost/app.php/acceuil et si je fais localhost/acceuil il m'affiche erreur 404