2017-08-17 110 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