Using dynamic programs such as jsp/php/asp to generate pages how to search engine friendly? You may want to use Url_rewrite. However, it is best to let the same URL at any time corresponding to the content of the page is the same or similar. Because the search engine does not like the page content is always changing URLs.
A general blog post needs to display the newly published article in front of it, so you will use an "ORDER BY ID DESC" SQL statement to query a page containing more than one article. For example, the following is in Java+mysql:
Public article[] Getarticlearray (int from, int size) {
article[] Article = new Article[0];
String query = "SELECT * from Blog ORDER by DESC ID LIMIT" + from + "," + size;
try{
ResultSet rs = st.executequery (query);
Rs.last ();
Size = Rs.getrow ();
Article = new Article[size];
Rs.beforefirst ();
for (int i=0; Rs.next (); i++) {
Article[i] = new article (
Rs.getint ("id"), rs.getstring ("Time"),
Rs.getstring ("name"), Rs.getstring ("blog")
);
}
Rs.close ();
}catch (Exception e) {
System.out.println (e);
}
return article;
}
This is one of our SEO page-class Myseopager methods. If we want to display the first page, we use Getarticlearray (0,10) to query the latest published 10 articles.
What's wrong with that? The problem is that when you add an article, all of the original pages change. In order for Getarticlearray (0,10) to display the same article for each query, you should let Getarticlearray (0,10) display the 10 newly published articles. We can change our paging class like this. Deleting the pages with the content that will affect the page, the more new articles you delete, the larger the page changes generated.
Public article[] Getarticlearray (int from, int size) {
article[] Article = new Article[0];
String query = "SELECT * from blog order by ID LIMIT" + from + "," + size;
try{
ResultSet rs = st.executequery (query);
Rs.last ();
Size = Rs.getrow ();
Article = new Article[size];
Rs.beforefirst ();
for (int i=0; Rs.next (); i++) {
Article[i] = new article (
Rs.getint ("id"), rs.getstring ("Time"),
Rs.getstring ("name"), Rs.getstring ("blog")
);
}
Rs.close ();
}catch (Exception e) {
System.out.println (e);
}
return article;
}
We also need to get the number of articles in the database, so add one more method.
public int Getarticlecount () {
int rowcount = 0;
String query = "SELECT COUNT (*) as rowcount from Ideabook";
try{
ResultSet rs = st.executequery (query);
if (Rs.next ()) {
RowCount = Rs.getint ("rowcount");
}
}catch (Exception e) {
System.out.println (e);
}
return rowcount;
}
We now display the latest 10 articles in the JSP page.
int start =-1;
Myseopager pager = new Myseopager ();
int artcount = Pager.getarticlecount ();
try{
Integer.parseint (Request.getparameter ("Start"));
}catch (Exception e) {
start = artcount-10;
}
if (Start > artcount-10) start = artcount-10;
if (Start < 0) start = 0;
Article art = Pager.getarticlearray (start, 10);
Do something and art here.
int previous = start + 10; To the start value of the previous page
int next = start-10; To the start value of the next page
In this way, whether or not the content of the generated page changes is related to whether you deleted the first published article. As long as you do not delete the article, showblog.jsp?start=0 with this parameter of the URL corresponding to the page does not change. As long as you delete the nth article, then start< (n-pagesize) The corresponding page does not change. You add articles only to affect the first page.
This method was used in the Ideabook message I wrote.