2017-07-29 171 views
0

我遵循了概述的步驟here。 我將以下代碼複製並粘貼到.htaccess文件中。 .htaccess文件位於包含我要在apache上部署的dist文件夾的同一個存儲庫中。apache服務器上的角度部署

RewriteEngine On 
# If an existing asset or directory is requested go to it as it is 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d 
RewriteRule^- [L] 

# If the requested resource doesn't exist, use index.html 
RewriteRule^/index.html 

當我訪問localhost/dist一切順利,因爲它會用我的index.html文件,它會自動重定向到localhost/dist/login。現在,如果我直接請求localhost/dist/login,apache抱怨並顯示The requested URL /dist/login was not found on this server.在我看來,apache並沒有拿起我的.htaccess設置。有什麼我做錯了嗎?

回答

0

最後我找到了解決我的問題的方法。也許這可能會有所幫助。我啓用的Apache的rewrite mode和替代

RewriteRule^/index.html

我寫

RewriteRule^/dist/index.html

,這解決了我的問題。