Rendre le dossier "/public/" en "/"

Par Imillix, il y a 11 ans


Bonjour,
je voudrais que quand je vais sur "localhost/Laravel/" ce soit comme si j'allais sur "localhost/Laravel/public/" histoire d'avoir une URL de base un peu plus propre.
Merci et bonne journée

15 réponses

Alexandre #lbac, il y a 11 ans

Il te faut un .htaccess, tu le trouveras dans la doc de laravel ;)

Imillix, il y a 11 ans

Justement, j'ai cherché et j'ai rien trouvé

Imillix, il y a 11 ans

J'ai essayé ce code mais ça me met :

Symfony\Component\HttpKernel\Exception\NotFoundHttpException thrown with message "" Stacktrace: #11 Symfony\Component\HttpKernel\Exception\NotFoundHttpException in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:5693 #10 Illuminate\Routing\RouteCollection:match in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:5015 #9 Illuminate\Routing\Router:findRoute in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:5003 #8 Illuminate\Routing\Router:dispatchToRoute in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:4995 #7 Illuminate\Routing\Router:dispatch in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:715 #6 Illuminate\Foundation\Application:dispatch in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:696 #5 Illuminate\Foundation\Application:handle in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:7758 #4 Illuminate\Session\Middleware:handle in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:8365 #3 Illuminate\Cookie\Queue:handle in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:8312 #2 Illuminate\Cookie\Guard:handle in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:10974 #1 Stack\StackedHttpKernel:handle in /Users/Imillix/dev/Sites/Laravel/bootstrap/compiled.php:657 #0 Illuminate\Foundation\Application:run in /Users/Imillix/dev/Sites/Laravel/public/index.php:49
Alexandre #lbac, il y a 11 ans

Ta configuration supporte l'url rewriting ?

As tu chmodé les fichiers de storage comme il faut ?

Imillix, il y a 11 ans

Oui mon system supporte l'url rewriting vu que cakephp marche
et ou se trouve les fichiers de storages ?

Alexandre #lbac, il y a 11 ans

dans app/ si j'ai bonne mémoire

Imillix, il y a 11 ans

C'est bon mais maintenant, j'ai une autre erreur comme quoi il ne trouve pas le index.php dans le repertoire "Laravel/" normal vu qu'il n'existe pas donc je ne sais pas quoi faire...

Alexandre #lbac, il y a 11 ans

Essayes ça

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule>
Imillix, il y a 11 ans

Ca ne marche toujours pas sauf que cette fois, laravel s'affiche bien mais m'affiche comme tout a l'heure

Alexandre #lbac, il y a 11 ans

Sinon la solution simple consiste à, quand tu mettres ton site en ligne. Faire pointer ton domaine /home/www sur home/laravel/public

Alexandre #lbac, il y a 11 ans

Remplaces le .htaccess que j'ai posté par celui-ci sinon pour tenter :

<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L] </IfModule>

Je précise que ce .htaccess doit se trouve à la racine, au même niveau que app/ et public/

Imillix, il y a 11 ans

Toujours pareil

Imillix, il y a 11 ans

Ok merci, je regarderais ça demain