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/  域名后面的目录

  • 相关阅读:
    【YbtOJ#911】欧拉函数
    【CF590E】Birthday
    打印控件的区别
    RPA教程
    UiPath培训教程
    RPA视频教程
    搭建samba服务
    kvm虚拟机在线扩容
    zabbix监控交换机
    UiPath Level3讲解
  • 原文地址:https://www.cnblogs.com/shenjilin/p/14696363.html
Copyright © 2011-2022 走看看