【问题标题】:React-Redux application on sub-directory using Apache Server使用 Apache 服务器的子目录上的 React-Redux 应用程序
【发布时间】:2018-01-10 10:50:34
【问题描述】:

我已经在 apache 服务器的子文件夹中部署了 react 应用程序

网址文件夹: /var/www/html/abc

我有以下 .htaccess 规则来重写请求

RewriteEngine On 
RewriteBase /abc
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /abc/index.html [L]

但它不起作用请帮我重写.htaccess规则

【问题讨论】:

    标签: apache reactjs .htaccess mod-rewrite


    【解决方案1】:

    只要把abc去掉放在目录下即可:

    # To be inside the /Directory
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.html$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.html [L]
    </IfModule>
    

    来源:https://gist.github.com/santthosh/7dabf08fa3859361ef1e

    【讨论】:

      猜你喜欢
      • 2016-09-20
      • 2019-01-14
      • 2019-01-22
      • 1970-01-01
      • 1970-01-01
      • 2020-04-11
      • 1970-01-01
      • 2020-12-09
      • 1970-01-01
      相关资源
      最近更新 更多