Step by step -90-seo (URL rewrite + hyperlink tricks)

Source: Internet
Author: User

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 modification

Modified only: <a href= "/ashx/seo.ashx" id= "A1" >mmm</a>

Step by step -90-seo (URL rewrite + hyperlink tricks)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.