概述 :
我想将访问者重定向到目录结构内的默认页面(index.html)上,以便在使用.htaccess
文件访问目录时显示(目前正在加载当前目录 index.html)。
但是当我$locationProvider.html5Mode(true)
在我的角度应用程序中打开时,会出现以下错误。
控制台错误:
应用程序的目录结构:
public_html
--prod
--public
--app
--controllers
--directives
--services
--app.config.js
--index.html
--.htaccess
.htaccess
public_html =>
.htaccess :
DirectoryIndex prod/public/index.html
这用于通过使用域名直接.htaccess
重定向应用程序页面 () 上的访问者,截至目前,当用户访问当前目录 ( ) index.html 正在加载的域时。prod/public/index.html
public_html
public_html =>
产品 =>
.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /prod/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /prod/public/#/$1
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/prod/$1 [L,R=301]
</IfModule>
产品 =>
公共 =>
index.html :
<base href="/prod/public/">
一切正常如果我$locationProvider.html5Mode(true)
从文件中删除。app.config.js
所以,当我注释掉$locationProvider
代码时,一切正常#
。/#/abc
我可以毫无问题地到达等。一旦我把$locationProvider
零件放回去,什么都没有发生。
Stack Overflow 上的相关问题没有成功: