1

I created a laravel 5.4 project i was testing it usin the command 'serve' now i deploy it on xampp only home page is working. when i try to access any pages i get the 404 error 'http://localhost/page1' when i add 'http://localhost/MyApp/public/page1' it works, i added : RewriteEngine On RewriteBase /MyApp/public/ to the htaccess file but it doesn't work.

Abdellaziz
  • 31
  • 9
  • It would be better for you to set up a virtual host and have the web root for that domain point to the public folder in your app https://laravel.com/docs/master#configuration . I don't use xampp so this might be out of date for the version you're using but it should at least get you on the right track https://delanomaloney.com/2013/07/10/how-to-set-up-virtual-hosts-using-xampp/ . Alternatively, you could use `php artisan serve` – Rwd Jul 13 '17 at 11:48
  • Yeah you need to point your host to the `public` folder – Andy Holmes Jul 13 '17 at 11:50
  • One waythat you can do this is by adding your site to the vhosyts, check out this [answer](https://stackoverflow.com/questions/31951931/how-to-enable-virtual-host-on-xampp-for-laravel) that details what you need to do: – yahyazini Jul 13 '17 at 11:51
  • thank you i solved the problem by changing the way i call urls, i was using , I changed it to and it works perfectly – Abdellaziz Jul 14 '17 at 11:39

2 Answers2

0

Change the DocumentRoot in the VirtualHost to :

DocumentRoot "/MyApp/public"

Make sure to put the full path of the public directory

Hope this helps !

OuailB
  • 1,099
  • 7
  • 9
0

I solved the problem and here's the solution.

I changed the wayl i was using urls from href="/Habilite" to * href="{!! url('/Habilite')!!}"*, that worked perfectly.

Abdellaziz
  • 31
  • 9