tomcat301與java301解析
tomcat 301很明顯不提供此功能應(yīng)該更正確的叫做JAVA301,適合要做友好SEO的朋友
不多做解釋,做SEO的話JAVA基本選urlrewrite,所以下面講的是如何結(jié)合urlrewrite做域名跳轉(zhuǎn)。對于301此文章基本是精華貼了。下面直接貼代碼。
注意下面的condition不是指你要攔截什么域名而是與你要跳轉(zhuǎn)的域名相對應(yīng),比如jb51.net跳www.dbjr.com.cn 那就在condition填www.dbjr.com.cn
第一種urlrewrite配置:
<urlrewrite>
<rule>
<name>seo redirect</name>
<condition name="host" operator="notequal">^www.dbjr.com.cn</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">http://www.dbjr.com.cn/$1</to>
</rule>
</urlrewrite>
第二種urlrewrite配置:
<urlrewrite>
<rule>
<name>seo redirect</name>
<condition name="host" operator="notequal">^www.dbjr.com.cn</condition>
<condition name="host" operator="notequal">^localhost</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">http://www.dbjr.com.cn/$1</to>
</rule>
</urlrewrite>
相關(guān)文章
關(guān)于struts返回對象json格式數(shù)據(jù)的方法
以下為大家介紹,關(guān)于struts返回對象json格式數(shù)據(jù)的方法,希望對有需要的朋友有所幫助。2013-04-04Java利用SpEL表達式實現(xiàn)權(quán)限校驗
這篇文章主要為大家詳細介紹了Java如何利用SpEL表達式實現(xiàn)權(quán)限校驗功能,文中的示例代碼講解詳細,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-01-01SpringBoot啟動異常Exception in thread “main“ 
本文主要介紹了SpringBoot啟動異常Exception in thread “main“ java.lang.UnsupportedClassVersionError,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-07-07springboot啟動前執(zhí)行方法的四種方式總結(jié)
這篇文章主要給大家介紹了關(guān)于springboot啟動前執(zhí)行方法的四種方式,文中通過實例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2022-01-01Java getResource()如何獲取class文件目錄位置
這篇文章主要介紹了Java getResource()如何獲取class文件目錄位置,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-12-12