jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

remove hashtag # in url by angularjs #407

Closed puahyan closed 7 years ago

puahyan commented 7 years ago

hi, i haved use this stack for some time, the only most problem i faced is the url #, First , in index.blade.php as html file i added
Second, in the config file i add add $locationProvider.html5Mode({ enabled: true, requireBase: true }); then i reload, the url working well from http:8000/#/home -> http:8000/home, However, when I copy the link to new tab, it show page not found by laravel, display laravel path not found error, it is because it detect the route by laravel in laravel routes,

if you refresh the page/reload again, it show page not found, i get annoyed by the # in url, so how to fix this , thanks

puahyan commented 7 years ago

pls provide technical answer how to , thanks

jadjoubran commented 7 years ago

Here's how to fix your issue: http://stackoverflow.com/questions/29484665/pretty-urls-in-angularjs-and-laravel-not-working

puahyan commented 7 years ago

YES SOLVE, the answer is change the return 404view to index view in handler.php, THANKS!!!!

puahyan commented 7 years ago

the only disadvantages is the console.log and network will display file not found error message

jadjoubran commented 7 years ago

You shouldn't show a 404, you should return the view('index');

puahyan commented 7 years ago

ya, thanks.