This article is for beginners of web development or small website administrators. Don't throw bananas.
Websites have several important factors. The following are three examples:
1. Fast access speed-at least fast access to the home page.
2. Beautiful pages (not in the scope of this article)
3. The input volume of search engines such as Google is large.
Now let's talk about the above two aspects: 1 and 3.
ASP, especially after a suffix such as Aspx. Many of them are used. In fact, these dynamic pages have several disadvantages.
1. The homepage is not suitable. Slow loading speed
2. There are few opportunities to be discovered by search engines.
Search engines do not like dynamic pages. At least it prefers static pages.
No matter how few or more content is displayed on the homepage of your website. Static pages are required to speed up user access. There are several specific practices.
1. If you do not know how to use a program to generate a static page. You can run dynamic pages first. View the source file. Copy the source code. Create a new text document/Replace the suffix with .htm, and put the content of the source file. Finally, upload the file to the root directory of your website through FTP.
2. It is easy to generate with a program. For example, if you use donet, you can use the httpwebrequest class to access your dynamic page address/use httpwebresponse to obtain the response code. Finally, use streamwrite to write a static page under the root directory. This requires manual operations in the background.
3. If your website is updated on a regular basis. You can write it as a Windows service. This method is used to generate static pages at regular intervals.
Here is a suggestion.
We recommend that you use web standards to develop the homepage. Use Div + CSS to layout your page. The biggest difference between table and DIV is that IE is used to display the two. When a table is encountered, it completely retrieves the entire table and then displays it. The DIV is displayed layer by layer. In this way, if your network speed is slow enough. Then the DIV can load a little bit to display a little bit. The table is displayed immediately after it is loaded. Better User Experience DIV/
Another problem is that some pages must be done with dynamic pages such as http://www.abc.com/get.aspx? Id = 3. We cannot use the method we just mentioned to achieve this. Because the website is not very timely. If it becomes a static page, it will be even worse /.
So such dynamic pages are not very good for Google and Baidu to search. Then we can find a way to turn it into a static page.
(Note: There are many technical points mentioned here, but few people actually do this)
Here is the simplest method. Take http://www.abc.com/get.aspx? Id = 3. Our goal is
The http://www.abc.com/3.html can also be accessed. Therefore, you can use the httpmodle Method for redirection.
This is not a technical article. So let me briefly talk about the code. (Using donet)
1. First, create a class library. For example, call getmodle to inherit the code of system. Web. ihttpmodule:
Using system. text;
Using system. Text. regularexpressions;
Namespace sthandler
{
/// <Summary>
/// Abstract description of itblog.
/// </Summary>
Public class itblog: system. Web. ihttpmodule
{
Public itblog ()
{
}
# Region ihttpmodule Member
Public void Init (system. Web. httpapplication context)
{
// Todo: add search. init to implement
Context. beginrequest + = new eventhandler (context_beginrequest );
}
Public void dispose ()
{
// Todo: add search. Dispose implementation
}
# Endregion
Private void context_beginrequest (Object sender, eventargs E)
{
Httpapplication context = (httpapplication) sender;
String sz_url = context. Request. url. tostring ();
RegEx RX = new RegEx (@"/(? <A> [/d] *?). Html ");
If (RX. Match (sz_url). Success)
{
String GETID = Rx. Match (sz_url). Result ("$1"). tostring ();
Context. response. Redirect ("/get. aspx? Id = "+ GETID. tostring ());
}
}
}
}
So that an address like http://www.abc.com/3.html will override the URL to the http://www.abc.com/get.aspx? Id = 3
Because this is not about URL redirection, we will not talk about the specific configuration.
Do this well. You can make your website look completely static. What if I let the search engine immediately notice you?
Here is an example of Google
First you need a Gmail account and then access the https://www.google.com/webmasters/sitemaps/siteoverview? Hl = zh_cn
Submit sitemaps to Google. Of course, the addresses in sitemaps should use the static fake addresses you just created.
I believe that Google will be very interested in you.
The last thing I want to talk about is. Web development is actually a combination of skills. Appropriate attention to these skills will make your website flourish. Of course, these skills are not the most important or substantive content. : ^ _ ^