【问题标题】:Vue Router HTML5 History mode .htaccess settings for only one pageVue Router HTML5 History 模式 .htaccess 设置仅为一页
【发布时间】:2020-03-19 16:56:06
【问题描述】:

我只在我网站的一页中添加了 Vue.js 和 Vue Router。我已经阅读了 Vue 路由器文档https://router.vuejs.org/guide/essentials/history-mode.html,但这适用于 SPA。我想知道我的 .htaccess 文件的正确配置,以便 /Portfolio.php 下的所有路由都重定向到该页面,但不会重定向到 /Contact.php 或 /index.php 等页面。我的网站在这里:https://test.joebaileyphotography.com

我尝试了以下配置无济于事:

<ifModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^Portfolio\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /Portfolio.php [L]
</ifModule>

【问题讨论】:

  • 配置 htaccess 以仅重写与您的 vue 路由相关的路径
  • 是的,这是我的问题

标签: apache .htaccess


【解决方案1】:

我通过将要应用 .htaccess 规则的页面放置在其自己的文件夹中来解决问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-24
    • 2018-10-04
    • 2018-04-08
    • 2017-05-29
    • 2018-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多