繁体   English   中英

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

[英]Angularjs get error 404 while page refresh

当我刷新页面时遇到错误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]

错误:

在此处输入图片说明

我解决了我的问题

刷新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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM