0

I have an angular app that works perfectly in localhost. I uploaded to a server and the layout-blade works perfectly, but it can not find the index page that goes in the ng-view. It just returns a 404 error.

Here is the approutes.js

angular.module('appRoutes', []).config(['$routeProvider','$locationProvider', '$httpProvider',function ($routeProvider, $locationProvider, $httpProvider) {
$routeProvider
 .when('/', {
 templateUrl: '/partials/index',
 controller: 'MainController'
 })

The index is in /resources/views/partials

The layout blade is in /resources/views

The head of that html has

I am in an apache2 server in an ubuntu machine.

Any ideas?

edit: This is my .htacess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
 Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /1ドル [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
6
  • If it works local with pretty url's it's because you configured local to always serve app entry point. Commented Jul 14, 2016 at 16:07
  • I am using a bolierplate so I did not configure anything. Any help on how to configure local or app entry point will really help Commented Jul 14, 2016 at 16:13
  • basically need mod rewrite which can put in htaccess. Should be easy to search Commented Jul 14, 2016 at 16:15
  • I just added my htaccess but I do not know how to rewrite it or even if I have to Commented Jul 14, 2016 at 16:25
  • That redirect makes it possible to load the index.php which loads the layoutblade, which is working. The problem is that it is not loading the rest of the partial views in the angular route service Commented Jul 14, 2016 at 16:28

2 Answers 2

1

In your root directory make a file named .htaccess and following code to that file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# not rewrite css, js and images
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /index.html?path=1ドル [NC,L,QSA]
answered Jun 9, 2017 at 8:21
Sign up to request clarification or add additional context in comments.

Comments

0

I just fixed by changing the AllowOverride None to AllowOverride All. That did that trick. Thanks

answered Jul 14, 2016 at 16:50

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.