【发布时间】:2016-09-08 01:09:33
【问题描述】:
我在 lighttpd 服务器中有一个 angularJS Web,但是当我刷新或执行直接链接时,html5 模式不起作用(错误 404)。我的本地服务器运行 Apache,.htaccess 中的重写表达式没有问题。 这是 Apache 代码:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
#Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule !\.\w+$ index.html [L]
</IfModule>
这是 lighttpd.conf 的内容
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
)
server.document-root = "/var/www/html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html$
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/htm$
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
$HTTP["host"] == "myweb.io" {
server.document-root = "/var/www/html/"
url.rewrite-once = ( "!\.\w+$" => "/index.html" )
}
我已经搜索了所有的互联网,但我没有找到任何关于此的信息。不知道是不是正则表达式写得不好,还是放错地方了。
【问题讨论】:
标签: angularjs html rewrite lighttpd mode