AngularJS在页面刷新时收到错误404

时间:2018-11-28 06:50:28

标签: javascript angularjs

当我刷新页面时,发现错误404-页面。

索引文件

 <base href="/Rushi/sandwichesuk/"/>  

App.js

  $locationProvider.html5Mode(true);
  $routeProvider
  .when('/index1', {
       templateUrl: 'assets/views/index1.html',
       controller: 'index1Controller'
    })   

这是我的.htaccess文件

RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ Rushi/sandwichesuk/index.html [L]

错误:

enter image description here

1 个答案:

答案 0 :(得分:0)

我解决了我的问题

引用https://lancelhoff.com/enabling-htaccess-in-apache-on-windows/

并更改.htaccess文件

 RewriteEngine on
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
 RewriteRule ^ - [L] 
 RewriteRule ^ /Rushi/sandwichesuk/index.html