Objective: To facilitate search engine crawling
URL rewriting: Add a URL with parameters such as: https://i.cnblogs.com/EditPosts.aspx?opt=1. Modify to Https://i.cnblogs.com/EditPosts.aspx_1
1: In Booklist, modify the following link method
href= "<% #Eval (" Id ","/goods/bookdetail_{0}.aspx ")%>" >
2: Add global file
Overriding the URL address in the Application_BeginRequest method
protected void Application_BeginRequest (Object sender, EventArgs e)
{
String url = request.apprelativecurrentexecutionfilepath;//~/goods/bookdetail_4939.aspx
Match match=regex.match (URL, @ "~/goods/bookdetail_ (\d+). aspx");
if (match. Success)
{
Context.rewritepath ("/goods/bookdetail.aspx?id=" +match. GROUPS[1]. Value);
}
}
Hyperlink tip: Because SEO executes JS script
<%@ Page language="C #"autoeventwireup="true"Codebehind="SeoTest.aspx.cs"inherits="BookShop.Web.Test.SeoTest"%><! DOCTYPE html>"http://www.w3.org/1999/xhtml">"Server"><meta http-equiv="Content-type"Content="text/html; Charset=utf-8"/> <title></title> <script src=".. /js/jquery-1.7.1.js"></script> <script type="Text/javascript">$ (function () {$ ("#a1"). Click (function () {$.post ("/ashx/seo.ashx", {}, function (data) {$ ("#div1"). append (data); }); return false; }); }); </script>"Form1"runat="Server"> <div> <a href="javascript:void (0)"Id="A1">mmm</a> <div id="Div1"></div> </div> </form></body>the original Code<%@ Page language="C #"autoeventwireup="true"Codebehind="SeoTest.aspx.cs"inherits="BookShop.Web.Test.SeoTest"%><! DOCTYPE html>"http://www.w3.org/1999/xhtml">"Server"><meta http-equiv="Content-type"Content="text/html; Charset=utf-8"/> <title></title> <script src=".. /js/jquery-1.7.1.js"></script> <script type="Text/javascript">$ (function () {$ ("#a1"). Click (function () {$.post ("/ashx/seo.ashx", {}, function (data) {$ ("#div1"). append (data); }); return false; }); }); </script>"Form1"runat="Server"> <div> <a href="/ashx/seo.ashx"Id="A1">mmm</a> <div id="Div1"></div> </div> </form></body>after modificationModified only: <a href= "/ashx/seo.ashx" id= "A1" >mmm</a>
Step by step -90-seo (URL rewrite + hyperlink tricks)