Abel Raj Abel Raj - 2 years ago 150
PHP Question

Deploy Laravel and Angular local with apache

I am using Laravel and angular. My app works with artisan serve command on localhost:8000

If i want to deploy locally without using artisan command I copied to var/www/html/ and run localhost/project/public it works.

My landing page is login and it routes with


But I click the link on the landing page i get 404 not found with url

I found a way with
. this works but my angular ng-view is blank.

How to make laravel with angular work without php artisan serve?

Answer Source

You're going to want to use something like a .htaccess rule to tell Apache to strip out index.php from the URL.

I've used the following on previous projects:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

EllisLab (creators of CodeIgniter framework) also have a good guide on this: https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download