我的react应用在本地运行良好,但是当我将其部署到开发服务器时,我无法点击刷新栏。如果这样做,它将立即引发404 not found错误。我无法使用地址栏手动导航。
我尝试修改服务器中的fun getExchangeEvents(email: String) {
val folderView = FolderView(100)
folderView.traversal = FolderTraversal.Deep
folderView.propertySet = PropertySet(FolderSchema.FolderClass,
FolderSchema.DisplayName, FolderSchema.TotalCount, FolderSchema.ParentFolderId)
val folders = exchangeService?.findFolders(WellKnownFolderName.MsgFolderRoot, folderView)
var appointmentFolder: Folder ?=null
for (folder in folders!!.folders)
{
if (folder.folderClass == "IPF.Appointment")
{
appointmentFolder = folder
break
}
}
val items = exchangeService?.findItems(appointmentFolder?.id,
SearchFilter.ContainsSubstring(AppointmentSchema.Location,email),
ItemView(min(appointmentFolder!!.totalCount, 5)))
Log.d("Teeeest0","Test3")
val itemArrayList = items?.items
if (itemArrayList != null) {
for (item in itemArrayList) {
val appointment = (item as Appointment)
Log.d("GotAppointment",("Got appointment item subject : "
+ appointment.location + "\n"
+ appointment.subject + "\n"))
}
}
文件。仍然没有运气。我尝试修改添加.htaccess
和其他内容的路由器,但还是没有运气。我了解这与browserhistory
有关。这是我当前正在使用的client side routing
文件
.htaccess
这是我在Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
中使用的通用代码
App.js
这是显示的错误消息
import React from "react";
import { Switch, Route,Link } from "react-router-dom";
import Backup from "./forms/backup_request/backupRequest";
import Restoration from "./forms/restoration_request/RestorationRequest";
import AssetRequest from "./forms/new_asset_request/AssetRequest";
class App extends React.Component {
render() {
return (
<div>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/backup_request" component={Backup} />
<Route path="/restoration_request" component={Restoration}/>
<Route path="/new_asset_request" component={AssetRequest} />
</div>
</Switch>
)
}
}
答案 0 :(得分:0)
修复了它。这是服务器端错误。需要在apache服务器上进行配置以接受.htaccess
文件。