去掉opencms路径上的两个opencms

前提:安装时一定要设置好域名,不要使用默认的localhost。

1、用root的方式安装,完成后可以去掉第一个opencms。

2.下载urlrewritefilter-3.2.0.zip,拷贝urlrewrite-3.2.0.jar到站点的lib文件夹下。

3.更改web.xml

如下:

 

[c-sharp]  view plain copy
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app xmlns="http://java.sun.com/xml/ns/j2ee"  
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4. xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"  
  5. version="2.4">  
  6.     <display-name>OpenCms</display-name>  
  7.     <description>  
  8.         OpenCms, the Open Source Content Management System.   
  9.         (c) 2010 Alkacon Software GmbH with contributions from the OpenCms community.  
  10.         For more details about OpenCms, please see http://www.opencms.org/.  
  11.         For more details about Alkacon Software GmbH, please see http://www.alkacon.com/.      
  12.     </description>  
  13.     <context-param>  
  14.         <param-name>OpenCmsServlet</param-name>  
  15.         <param-value>/opencms/*</param-value>  
  16.     </context-param>  
  17.     <context-param>  
  18.         <param-name>DefaultWebApplication</param-name>  
  19.         <param-value>ROOT</param-value>  
  20.     </context-param>      
  21.     <listener>  
  22.         <listener-class>org.opencms.main.OpenCmsListener</listener-class>  
  23.     </listener>  
  24. <!-- add filter for url -->  
  25. <filter>    
  26.      <filter-name>UrlRewriteFilter</filter-name>    
  27.      <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>    
  28.     
  29.      <init-param>    
  30.       <param-name>confReloadCheckInterval</param-name>    
  31.       <param-value>-1</param-value>    
  32.      </init-param>    
  33.     
  34.      <init-param>    
  35.       <param-name>logLevel</param-name>    
  36.       <param-value>ERROR</param-value>    
  37.      </init-param>    
  38.           
  39.      <init-param>    
  40.       <param-name>statusEnabled</param-name>    
  41.       <param-value>false</param-value>    
  42.      </init-param>    
  43.          
  44.      <init-param>    
  45.       <param-name>statusPath</param-name>    
  46.       <param-value>/status</param-value>    
  47.      </init-param>    
  48.     </filter>    
  49.     
  50.     <filter-mapping>    
  51.      <filter-name>UrlRewriteFilter</filter-name>    
  52.      <url-pattern>/*</url-pattern>    
  53.     </filter-mapping>    
  54.   
  55.     <servlet>  
  56.         <description>  
  57.             The main servlet that handles all requests to the OpenCms VFS.    
  58.         </description>  
  59.         <servlet-name>OpenCmsServlet</servlet-name>  
  60.         <servlet-class>org.opencms.main.OpenCmsServlet</servlet-class>  
  61.         <load-on-startup>1</load-on-startup>  
  62.     </servlet>  
  63.     <servlet>  
  64.         <description>  
  65.             The error handling servlet, also serves as trigger for static export requests.    
  66.         </description>  
  67.         <servlet-name>OpenCmsServletErrorHandler</servlet-name>  
  68.         <servlet-class>org.opencms.main.OpenCmsServletErrorHandler</servlet-class>  
  69.         <load-on-startup>0</load-on-startup>  
  70.     </servlet>      
  71.     <servlet>  
  72.         <description>  
  73.             Creates an access to OpenCms through WebDAV.  
  74.         </description>  
  75.         <servlet-name>OpenCmsWebDavServlet</servlet-name>  
  76.         <servlet-class>org.opencms.webdav.CmsWebdavServlet</servlet-class>  
  77.         <init-param>  
  78.           <param-name>listings</param-name>  
  79.           <param-value>true</param-value>  
  80.         </init-param>  
  81.         <init-param>  
  82.           <param-name>readonly</param-name>  
  83.           <param-value>false</param-value>  
  84.         </init-param>  
  85.         <init-param>  
  86.           <param-name>repository</param-name>  
  87.           <param-value>standard</param-value>  
  88.         </init-param>  
  89.     </servlet>  
  90.     <servlet-mapping>  
  91.         <servlet-name>OpenCmsServlet</servlet-name>  
  92.         <url-pattern>/opencms/*</url-pattern>  
  93.     </servlet-mapping>  
  94.     <servlet-mapping>  
  95.         <servlet-name>OpenCmsServletErrorHandler</servlet-name>  
  96.         <url-pattern>/opencms-errorhandler/*</url-pattern>  
  97.     </servlet-mapping>  
  98.     <servlet-mapping>  
  99.       <servlet-name>OpenCmsWebDavServlet</servlet-name>  
  100.       <url-pattern>/webdav/*</url-pattern>  
  101.     </servlet-mapping>  
  102.     <session-config>  
  103.         <session-timeout>30</session-timeout>  
  104.     </session-config>  
  105.     <welcome-file-list>  
  106.         <welcome-file>index.jsp</welcome-file>  
  107.         <welcome-file>index.html</welcome-file>  
  108.         <welcome-file>index_export.html</welcome-file>  
  109.     </welcome-file-list>  
  110.     <error-page>  
  111.         <error-code>404</error-code>  
  112.         <location>/opencms-errorhandler/handle404</location>  
  113.     </error-page>  
  114. <error-page>  
  115.         <error-code>500</error-code>  
  116.         <location>/opencms-errorhandler/system/handler/handle500.html</location>  
  117.     </error-page>  
  118. <jsp-config>  
  119.    <taglib>  
  120.        <taglib-uri>http://www.opencms.org/taglib/cms</taglib-uri>  
  121.        <taglib-location>/WEB-INF/opencms.tld</taglib-location>  
  122.    </taglib>  
  123. </jsp-config>  
  124. </web-app>  
 

 

 

3、配置urlrewrite.xml

如下:

 

 

[c-sharp]  view plain copy
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"  
  3.         "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">  
  4. <!--  
  5. Configuration file for UrlRewriteFilter  
  6. http://tuckey.org/urlrewrite/  
  7. -->  
  8. <urlrewrite>     
  9.     <rule>      
  10.         <from>^/tc-mgr/(.*)$</from>      
  11.         <to>/tc-mgr/$1</to>      
  12.     </rule>     
  13.   <rule>    
  14.    <condition type="request-uri" operator="notequal">^/export/.*$</condition>    
  15.    <condition type="request-uri" operator="notequal">^/resources/.*$</condition>    
  16.    <condition type="request-uri" operator="notequal">^/opencms-errorhandler/.*$</condition>    
  17.    <condition type="request-uri" operator="notequal">^/webdav/.*$</condition>    
  18.    <condition type="request-uri" operator="notequal">^/opencms/.*$</condition>    
  19.    <condition type="request-uri" operator="notequal">^/setup/.*$</condition>    
  20.    <from>^/(.*)$</from>    
  21.    <to>/opencms/$1</to>    
  22. </rule>    
  23. </urlrewrite>   
 

 

 

4. 去修改/WEB-INF/config下opencms-importexport.xml里面<vfs-prefix>${CONTEXT_NAME}&{SERVLET-NAME}</vfs-prefix> 为<vfs-prefix>${CONTEXT_NAME}</vfs-prefix>

 

完事重启OK

你可能感兴趣的:(去掉opencms路径上的两个opencms)