jsp 301Öض¨ÏòµÄÒâÒ弰ʵÏÖ
Ê×ÏÈ,˵һÏÂ301Öض¨ÏòµÄÒâÒåÓë×÷ÓÃ(ÍøÉÏÕÒµÄÏà¹Ø×ÊÁÏ)
ÆäʵÕâ¾ÍÉæ¼°µ½ÁËSEOµÄ֪ʶ¡£
ʲôÊÇ301תÏò£¿
´ÓËÑË÷ÒýÇæÓÅ»¯½Ç¶È³ö·¢£¬301Öض¨ÏòÊÇÍøÖ·Öض¨Ïò×îΪ¿ÉÐеÄÒ»ÖÖ°ì·¨¡£µ±ÍøÕ¾µÄÓòÃû·¢Éú±ä¸üºó£¬ËÑË÷ÒýÇæÖ»¶ÔÐÂÍøÖ·½øÐÐË÷Òý£¬Í¬Ê±ÓÖ»á°Ñ¾ÉµØÖ·ÏÂÔÓеÄÍⲿÁ´½ÓÈçÊýתÒƵ½ÐµØÖ·Ï£¬´Ó¶ø²»»áÈÃÍøÕ¾µÄÅÅÃûÒòΪÍøÖ·±ä¸ü¶øÊÕµ½Ë¿ºÁÓ°Ï졣ͬÑù£¬ÔÚʹÓÃ301ÓÀ¾ÃÐÔÖض¨ÏòÃüÁîÈöà¸öÓòÃûÖ¸ÏòÍøÕ¾Ö÷Óòʱ£¬Ò಻»á¶ÔÍøÕ¾µÄÅÅÃû²úÉúÈκθºÃæÓ°Ïì¡£
301תÏò(»ò½Ð301Öض¨Ïò£¬301Ìøת)Êǵ±Óû§»òËÑË÷ÒýÇæÏòÍøÕ¾·þÎñÆ÷·¢³öä¯ÀÀÇëÇóʱ£¬·þÎñÆ÷·µ»ØµÄHTTPÊý¾ÝÁ÷ÖÐÍ·ÐÅÏ¢(header)ÖеÄ״̬ÂëµÄÒ»ÖÖ£¬±íʾ±¾ÍøÒ³ÓÀ¾ÃÐÔתÒƵ½ÁíÒ»¸öµØÖ·¡£
ÆäËü³£¼ûµÄ״̬Â뻹°üÀ¨£¬200±íʾһÇÐÕý³££¬404ÍøÒ³ÕÒ²»µ½£¬302ÔÝʱתÏò£¬µÈµÈ¡£
ΪʲôҪÓÃ301תÏò£¿
ÍøַתÏò·½·¨Ö÷Òª°üÀ¨£º301תÏò£¬302תÏò£¬JavaScriptתÏò£¬PHP/ASP/CGIתÏò£¬META REFRESHÍøÒ³METAˢУ¬µÈ¡£302תÏò¿ÉÄÜ»áÓÐURL¹æ·¶»¯ÎÊÌâ¡£ÆäËü·½·¨¶¼Êdz£ÓõÄ×÷±×ÊÖ·¨£¬µ±È»²»ÊÇ˵²»¿ÉÒÔÕýµ±µØÓ㬷½·¨±¾ÉíûÓÐ´í£¬µ«±»×÷±×ÕßÓöàÁË£¬ËÑË÷ÒýÇæ¶ÔÕâЩ¿ÉÒɵÄתÏò¶¼ºÜÃô¸Ð¡£ºÎ±ØðÏÕÄØ¡£
µ±ÍøÒ³AÓÃ301Öض¨Ïòתµ½ÍøÒ³Bʱ£¬ËÑË÷ÒýÇæ¿ÉÒԿ϶¨ÍøÒ³AÓÀ¾ÃµÄ¸Ä±äλÖ㬻òÕß˵ʵ¼ÊÉϲ»´æÔÚÁË£¬ËÑË÷ÒýÇæ¾Í»á°ÑÍøÒ³Bµ±×÷ΨһÓÐЧĿ±ê¡£ºÃ´¦ÊÇ£¬µÚÒ»£¬Ã»ÓÐÍøÖ·¹æ·¶»¯ÎÊÌ⣬µÚ¶þ£¬Ò²ºÜÖØÒªµÄ£¬ÍøÒ³AµÄPRÍøÒ³¼¶±ð»á´«µ½ÍøÒ³B¡£
ÔÚJSPÖÐÈçºÎÀ´ÊµÏÖÕâ¸ö301µÄתÏòÄØ£¿
ÈçÒ»Ò³Ãæarticle.sjp
[code]
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location","/other.jsp");
return;
%>
[code]
ÔÚapacheÖÐÈçºÎʵÏÖ301תÏòÄØ?
±à¼.htaccessµÄ·½·¨¡£
×¢Ò⣺ÔÚÉèÖÃ301Öض¨Ïò֮ǰÎñ±Ø±¸·ÝÏàӦĿ¼ÏµÄ.htaccessÎļþ¡£
1.Öض¨Ïòdomain.comµ½www.domain.com
ÕâÖÖÖض¨ÏòÖ¼ÔÚʹÓòÃûΨһ£¬ÊÇÍøÕ¾SEO±ØÐëÒª×öµÄ£¬ºóÃæÖض¨Ïòwww.domain.comµ½domain.comÒ²ÊdzöÓÚͬÑùµÄÔÒò£¬Ö»ÊÇÐÎʽ²»Í¬¡£
´ò¿ª.htaccessÎļþ£¬¼ÓÈëÒÔϹæÔò¡£(ÏÂÃæµÄ¹æÔòÊÇÕë¶ÔÖ÷ÓòÃûµÄ£¬×ÓÓòÃûÒªÐÞ¸Ä)
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
2.Öض¨Ïòwww.domain.comµ½domain.com
RewriteEngine On
Ïà¹ØÎĵµ£º
JSPÓï·¨Ïê½â[תÌû]
HTML×¢ÊÍ:
1) ¿ÉÒÔÓÃ×¢ÊÍÄÚÈÝ,Ò²¿ÉÒÔÓñí´ïʽ.
2)Òþ²Ø×¢ÊÍ:
×¢Êͻᱠ......
̽Ë÷Èí¼þ¹¤×÷ÊÒ³¤ÆÚרҵ³Ð½ÓÖÐСÐÍÉÌÒµÈí¼þ»òÍøÕ¾£¬×îÓŻݵļ۸ñºÍ¸ßÖÊÁ¿µÄ·þÎñÆÚ´ýÄúµÄ»Ý¹Ë£¡
±¾¹¤×÷ÊÒ³Ð½Ó JSP ASP VB PB LotusNotes µÈÓïÑÔÒªÇóµÄÓ¦ÓÃϵͳ¿ª·¢ÒµÎñ
java jspʵսԴ³ÌÐò´úÂë:
......
̽Ë÷Èí¼þ¹¤×÷ÊÒ³¤ÆÚרҵ³Ð½ÓÖÐСÐÍÉÌÒµÈí¼þ»òÍøÕ¾£¬×îÓŻݵļ۸ñºÍ¸ßÖÊÁ¿µÄ·þÎñÆÚ´ýÄúµÄ»Ý¹Ë£¡
±¾¹¤×÷ÊÒ³Ð½Ó JSP ASP VB PB LotusNotes µÈÓïÑÔÒªÇóµÄÓ¦ÓÃϵͳ¿ª·¢ÒµÎñ
java jspʵսԴ³ÌÐò´úÂë:
......
Á¬½ÓACCESSÊý¾Ý¿âµÄ¼òµ¥JSP´úÂ룺
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="java.sql.*" %>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
String url="jdbc:odbc:Driver={MicroSoft Access Drive ......
ÍøÕ¾×öÍêºó£¬²¢²»ÊÇÖ±½Ó·Åµ½·þÎñÆ÷£¨Tomcat£©ÖÐÈ¥ÔËÐУ¬¶øÊÇÏȽ«Æä´ò°ü³ÉWarÎļþ£¬ÔÙ°ÑWarÎļþ·Åµ½·þÎñÆ÷ÖÐÈ¥ÔËÐУ¬ÄÇÑù¸ü·½±ã
ÄÇôÔõÑù½«Ò»¸öJspÍøÕ¾´ò°üÄØ£¿£¿£¿
Ò».·½·¨Ò»
½øÈëcmdµ½dosÃüÁîÐÐÏ£¬½øÈëJspWeb(×¢ÒâÒª½øÈëJspWebĿ¼£¬¼´½øÈëÄãÒª´ò°üµÄÍøÕ¾µÄ¸ùĿ¼)
ÔÙÏÂÒ»²½
......