[英]React Router not functional when deployed in a sub-directory On Apache
[英]React-Redux application on sub-directory using Apache Server
我已經在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
規則
只需刪除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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.