2017-08-17 112 views
0

這是一個簡單的問題,但即時通訊開發者,但我什麼都不知道虛擬主機,我有一個應用程序在ReactJS和它的工作正常在主頁www.example.com,但是當我去www。 example.com/someword這回我404.我vistual主機conf:React JS虛擬主機

<VirtualHost *:80> 
    ServerName somepage.com 
    ServerAlias somepage.com www.somepage.com 
    DocumentRoot "/var/www/somepage/build/" 
    DirectoryIndex index.html 
<Directory "/var/www/somepage/build/"> 
    AllowOverride All 
    Order allow,deny 
    Allow from All 
</Directory> 
ErrorLog /var/log/apache2/somepage_error.log 
CustomLog /var/log/apache2/somepage_access.log combined 
</VirtualHost> 

感謝您的幫助。

回答

0

實際上,在反應諸如example.com/somethingexample.com/something/inside_something的每一條路徑時,都應該以index.html存在於根文件夾內而不管已經命中的路由如何。在默認的Apache Web服務器/什麼手段,從那裏

在根文件夾中打開文件夾something和渲染的index.html嘗試這種解決方案是否可行https://gkedge.gitbooks.io/react-router-in-the-real/content/apache.html

+0

Thaks ..!這解決了我的問題。 – Kelvins