2015-08-03 56 views
1

我有一個lighttpd的服務器的網絡angularJS,但是當我刷新HTML5模式不起作用(錯誤404),或者做一個直接的聯繫。我有我的本地服務器運行Apache,在.htaccess中的重寫表達式沒有問題。 這是Apache代碼:的lighttpd和AngularJS HTML5模式

<IfModule mod_rewrite.c> 
    Options +FollowSymlinks 
    #Options +SymLinksIfOwnerMatch 
    RewriteEngine On 
    RewriteRule !\.\w+$ index.html [L] 
</IfModule> 

,這是

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") 
} 

我已經找遍了所有的互聯網,我還沒有發現這事的lighttpd.conf的內容。我不知道如果我沒有寫好正則表達式,或者我把它放在錯誤的地方。

回答

0

只需設置以下的伎倆對我來說:(無需mod_rewrite的)

server.error-handler-404 = "/index.html" 

但是,要警惕在明顯的bug舊版本如docs中所述。