codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » ASP » Article

Create search engine friendly static pages from a dynamic page in ASP

Article by:  Jeff Anderson  ( 1362 ) (4/28/2003)
Bookmark us now! Add to Favourites
Email a friend! Tell a friend
Summary: This script shows you how to build a series of static pages for items in your database, to increase search engine friendliness.
Viewed: 37335 times Rating (31 votes): 
 3.9 out of 5
  Rate this Article   Read Comments   Post Comments

Create search engine friendly static pages from a dynamic page in ASP



Let's say you've got a page called product.asp which receives a querystring product_id, as in

/products/product.asp?product_id=351

In your dynamic page, you display the product based on the product_id you receive.

Change the product.asp page so the entire contents fall within a function called show_product(product_id), as in

Select All Code


Now you just need to generate a page for each product_id in the database. This is what the page will look like for product_id 351:

Select All Code


Here's how to generate a file like that for every product_id in the database. Don't forget to use your own dsn, and to ensure you have write permission on the directory (here the directory is called products)

Select All Code


So now, instead of calling /products/product.asp?product_id=351 you simple call /products/351.asp

but best of all, you still have all your code in one page (/product.html) so any global changes are still just as easy to make.




CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Create search engine friendly static pages from a dynamic page in ASP '
Posted by :  Archive Import (Leonardo) at 22:57 on Wednesday, April 30, 2003
you've gotta be kidding me, what if I have 2,000 products.

THere are much better ways to do this using free isapi filter.

Not everybody should be writing articles
Posted by :  Archive Import (Jeff Anderson (article author)) at 02:37 on Thursday, May 01, 2003
Sorry you feel that Leonardo, but I've used this for several thousand products with great success (in both the site and the search engines) - the only very minor drawback is you get one folder with lots of tiny files in. But you can make that folder separate from any other files and it doesn't get in the way, neither does it use much memory.
Posted by :  Archive Import (Ron) at 15:33 on Thursday, May 01, 2003
What happens if I have 100,000 products and I want sell all of them today?
Posted by :  Archive Import (Hendo) at 21:32 on Thursday, May 01, 2003
Good idea but what about using an ASP custom 404 page which runs a server.transfer to the page of your choosing. Then you won't need any files in your site at all.

Just my $0.02 :-)
Posted by :  Archive Import (mick) at 03:34 on Wednesday, May 07, 2003
In the past I have generated a static html page (extension .html) every time an item is added to the database. The only dynamic page then is the one that lists the links to the static pages. It's very easy to do and only involves writing the code once.
Posted by :  Archive Import (John) at 15:01 on Monday, May 26, 2003
Leonardo wrote
"THere are much better ways to do this using free isapi filter."

Leonardo,

Where do you find this free isapi filter?

Thanks,
John
Posted by :  Archive Import (Jeremy Leppan) at 07:30 on Friday, September 05, 2003
I agree with Leonardo ,

Its guys like you, who come up with these so-called great ideas. And get the marketing / sales people all excited , cause of search engine friendlyness.

What Leonardo is trying to point out. Is that your idea is simply not practicle. And not scalable enough.

So readers, instead of doing it this way. Invest the time and learn some ISAPI.

and do not talk crap 1000's of products working in this way... bull
Posted by :  Archive Import (leonard) at 12:37 on Friday, September 05, 2003
how do i create a picture search engine
Posted by :  Archive Import (Gordon) at 06:19 on Monday, September 08, 2003
have a look at CNN.com this is how they do it, or some thing very close. i doubt that they right 10000's of pages and then the editor say's how about we change our general format, its just not done.!!!!
Posted by :  Archive Import (wEnzAt|oN) at 23:20 on Monday, September 08, 2003
But what if the files are on another server but on the same LAN? got any idea how to communicate with two servers using ASP?¿
Posted by :  waldweben at 04:38 on Saturday, November 22, 2003
Negative guys those Leonardo and Jeremy. Jeff's solution is a correct, free and very practical one. Who's talking about 100.000 products?
Nobody is waiting for remarks from people like Leonardo and Jeremy.

<Added>

Ok your remark about ISAPI filters is valuable.

<Added>

By the way: Jeff's technique does NOT mean you have to use static pointers instead of dynamic!!! Generating static pages are ONLY created for search engine purposes. Normal surfing your site will call the dynamic pages of course!
Posted by :  waldweben at 04:53 on Saturday, November 22, 2003
Hello Hendo,

Good tip. If somebody is searching for an item id on your site the correct page will be found. However a search engine will never find them, as it is only investigating existing pages on your site. It is not guessing all possible item codes!
This technique works only if you post all virtually pages (item id's) to search engines manually.
Posted by :  aleys at 14:23 on Monday, December 01, 2003
There is a good URL Rewrite for ASP - http://smalig.com/url_rewrite-en.htm - does the same work as author described but w/o any database :-)))

<Added>

There is a good URL Rewrite for ASP

http://www.smalig.com/url_rewrite-en.htm

does the same work as author described but w/o any database :-)))
Posted by :  sliechti at 08:05 on Monday, January 19, 2004
If you guys want a little more power, you might find mod_rewrite for IIS interesting. It uses regular expressions, so you can make the url look the way you want. Check it out at http://www.iismods.com

Happy coding.

<Added>

If you guys want a little more power, you might find mod_rewrite for IIS interesting. It uses regular expressions, so you can make the url look the way you want. Check it out at http://www.iismods.com

Happy coding.
Posted by :  angkorboy at 22:49 on Monday, May 23, 2005
What is the best way to use 404 Custom Page to Run.server transfer ?? Please Help !!!!


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP GetTempName
by Jeff Anderson
Use the GetTempName method to create a randomly generated temporary file on the server.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
ASP Format Date and Time Script
by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function.
Email validation using Regular Expression
by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP.
ASP FileExists
by Jeff Anderson
An introduction to the FileExistsMethod of the FileSystemObject
Add or Subtract Hours in SQL or ASP using DateAdd
by Jeff Anderson
A beginners guide to using the SQL DATEADD function to add or subtract hours. Particularly useful when setting the time displayed on the ASP page to a different time zone (eg when the server is in the US, and the site is for a UK audience).
Creating a Dynamic Reports using ASP and Excel
by Jeff Anderson
A simple way to generate Excel reports from a database using Excel.
ASP CreateTextFile
by Jeff Anderson
An explanation of the CreateTextFile Method, part of the ASP FileSystemObject
Concatenate strings in sql
by Jeff Anderson
A brief introduction to concatenating strings in an sql query (using SQL server or access databases).








Recent Forum Threads
•  Re: Compare date / time < 5
•  Re: Difference between two dates including From & To date
•  Disabling ActiveX dialog box in IE
•  Calling a matlab function to work in an array
•  Re: Browse button /filedialog in perl tk:
•  Re: horizontal scroll bar for drop down list box
•  How to give two actions for a single href
•  Re: Need Help with a Regular Expression
•  Re: Lightweight components reuses its parents graphical units. Heavyweight components


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010