簡體   English   中英

Angular JS-LocationProvider HTML5mode()和網址

[英]Angular js - LocationProvider HTML5mode() and urls

我已經啟用了

locationProvider.HTML5mode(true);

然后我放在index.html之上:

<html ng-app="app">
<head>
 <base href="/projects/www/#/" />

因此,如果我使用內部鏈接瀏覽網站,例如(#/ users)一切正常,則URL從projects/www/#/users重寫為projects/www/users

但是,如果我直接通過瀏覽器轉到projects/www/users找不到頁面。

唯一有效的直接網址是:

projects/www/

這可能是什么?

好吧,我修復了添加一些服務器端htaccess代碼的問題:

RewriteEngine on
RewriteBase /Projects/www
# 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 ^ index.html [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM