I am using angularjs as front end with laravel as backend. I have experience with laravel but Angular is very new to me. I have created simple angular application with laravel RESTFUL Service. In local system, I am using Wamp and I can access my application as below in my local system
http://localhost/MYAPPNAME/public/index.html
It is working fine in my local system. When I try to upload it to the server, then it shows blank page with error '404 (Not Found)' for all my angular js files.
I have uploaded my project files in root of the server and I have moved all angular js files and html files out of public folder and I have placed them in root folder of server. My folder structure is
My app js
$authProvider.baseUrl = '/';
$authProvider.loginUrl = '/api/authenticate';
$urlRouterProvider.otherwise('/login');
$stateProvider
.state('login', {
url: 'login',
templateUrl: 'js/tpl/login.html',
controller: 'AuthController'
})
.state('register', {
url: 'register',
templateUrl: 'js/tpl/register.html',
controller: 'AuthController'
})
.state('users', {
url: 'users',
templateUrl: 'js/tpl/users.html',
controller: 'UserController'
})
.state('orders', {
url: 'order',
templateUrl: 'js/tpl/orders.html',
controller: 'OrderController'
});
My htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
I hope it is a small issue in path configuration either in htaccess or app.js file but I am not sure about it. Please guide me to solve this issue. thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire