에 내가 응용 프로그램의 URL에서 해시 (#)를 제거하고 싶었 :페이지 라우터 모드로로드되지 않습니다 역사를 아파치
http://localhost/CoreUI-Vue/Vue_Starter/dist/#/dashboard
http://localhost/CoreUI/Vue_Starter/dist/dashboard
그래서 난 vue-router
에 mode
옵션을 변경했습니다 router/index.js
에서 history
-hash
에서 : 나중에
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
mode: 'history',
하지만, 나는 recompil 때 에드 소스 코드 (npm run build
) 및 응용 프로그램 (http://localhost/CoreUI/Vue_Starter/dist/dashboard
)를 개설, 그것은 빈 페이지로드 :
<body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
<!---->
<script type="text/javascript" src="./static/js/manifest.7c717a1bcc0cc7dc29c1.js"></script>
<script type="text/javascript" src="./static/js/vendor.dfb9d96e757ce802aece.js"></script>
<script type="text/javascript" src="./static/js/app.1cbf93c84add6c85b943.js"></script>
</body>
문제없이 응용 프로그램 mode: 'hash'
(http://localhost/CoreUI/Vue_Starter/dist/#/dashboard
) 부하 라우터 반면 :
<body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
<div class="app">
(...app content...)
</div>
<script type="text/javascript" src="./static/js/manifest.a2cf3e09f095de958e46.js"></script>
<script type="text/javascript" src="./static/js/vendor.dfb9d96e757ce802aece.js"></script>
<script type="text/javascript" src="./static/js/app.72b651a6c3b2660db094.js"></script>
</body>
내가 실현 이 추가 설정은 웹 서버가 작동하도록 제공되어야하지만 여전히 도움이되지 않습니다.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
.htaccess
이 동일에 있습니다 내가 (vue-router docs에서 복사) .htaccess
역사 라우터에 대한 지원을 제공
LoadModule rewrite_module modules/mod_rewrite.so
: 아파치의 설정 httpd.conf
에서
index.html
폴더에 저장하십시오.
가장 많이 사용되는 Webpack/Vue boilerplate 템플릿을 사용하는 빈 CoreUI-Vue 템플릿에서 작업 중이므로 내 코드 또는 구성에 특별한 내용이 없습니다.
지금 당장은이 서버를 사용하지 말고'RewriteBase'는'/ CoreUI/Vue_Starter/dist /'여야합니다. –