zoukankan      html  css  js  c++  java
  • vue-router history 使用

    1. 修改router/index.js 

      mode: "history"

      base: "page"   // 打包后放到服务器上,  域名后面的目录 127.0.0.1/page/index.html

    2. 修改vue.config.js 

      publicPath: '/page/'

    3. 基于Apache服务配置文件修改

     /conf/httpd.conf   开启rewrite_module

      a. 找到 LoadModule rewrite_module libexec/apache2/ mod_rewrite.so  去掉#, 打开注释

        一般搜索 mod_rewrite.so ,  红色部分有的版本有,有的没有

      b. 找到 AllowOverride None    修改为   AllowOverride All    来使.htaccess 文件生效

    4. 在127.0.0.1/page/  目录下添加.htaccess文件

      <IfModule mod_rewrite.c>
              RewriteEngine On
            RewriteBase /
            RewriteRule ^index.html$ - [L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /page/index.html [L]
          </IfModule>

    最后一行  ./page/  域名后面的目录

  • 相关阅读:
    事务
    排序算法
    二维数组中的查找
    在Linux中安装Matlab
    null和“”的区别
    【学习笔记】〖九度OJ〗题目1433:FatMouse
    【学习笔记】〖九度OJ〗题目1464:Hello World for U
    year:2017 month:8 day:1
    year:2017 month:07 day:31
    year:2017 month:7 day:27
  • 原文地址:https://www.cnblogs.com/shenjilin/p/14696363.html
Copyright © 2011-2022 走看看