在WebSphere服务器中进行静态网站托管。

huangapple 未分类评论46阅读模式
英文:

Static website hosting in Websphere server

问题

以下是翻译好的内容:

我对WebSphere还不熟悉,正在尝试在WebSphere中托管静态网站,并寻找将URL重定向到index.html以使客户端路由正常工作的方法。

我创建了WEB-INF和web.xml以实现路由,但似乎没有起作用。

MyApp
---- WEB-INF
-------- web.xml
---- index.html

web.xml的创建如下所示:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <error-page>
        <error-code>404</error-code>
        <location>/index.html</location>
    </error-page>
</web-app>

我是否漏掉了什么?当我直接浏览URL时,仍然显示404错误,这意味着路由没有生效。

例如:domain/example/1

有什么处理这个问题的想法/建议吗?

谢谢

英文:

I am new to Websphere and trying to host a static website in web sphere and looking for the redirection of URLs to index.html to make client side routing work.

I created the WEB-INF and web.xml to achieve routing but it doesnt seems working.

MyApp
---- WEB-INF
-------- web.xml
---- index.html

The web.xml is created like below

&lt;web-app xmlns=&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;
&#160; &#160; &#160; &#160; &#160;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
&#160; &#160; &#160; &#160; &#160;xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/javaee
&#160; &#160; &#160; &#160; &#160;http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd&quot;
&#160; &#160; &#160; &#160; &#160;version=&quot;3.1&quot;&gt;
&#160; &#160; &lt;error-page&gt;
          &lt;error-code&gt;404&lt;/error-code&gt;
          &lt;location&gt;/index.html&lt;/location&gt;
     &lt;/error-page&gt;
&lt;/web-app&gt;

Am i missed anything, when i browse urls directly i am still getting 404, means the routing is not picking.

Eg: domain/example/1

Any idea/suggestion to handle this.

Thanks

huangapple
  • 本文由 发表于 2020年4月10日 23:07:39
  • 转载请务必保留本文链接:https://java.coder-hub.com/61143170.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定