| Site Map | WizTools.org | jCraze Blog |
![]() |
Dynamic, Search Engine Friendly PagesThe procedure described below was tested on a RedHat7.2 system running Apache web server. You have to digest some bitter facts. Most search engines do not index URLs having the characters `?' & `='. It is standard practice to generate thousands of pages using just one template page. Such dynamic generation (from database, XML repository or any other source) traditionally required the use of `?'. The value after `?' in a URL is available as a CGI variable. So a single template page with different arguments would generate different pages. So how do you generate dynamic pages, without making them search engine unfriendly? Consider this URL: http://foo.com/template.php?var1=val1&var2=val2 This definitely is not search engine friendly. So you re-write the URL as: http://foo.com/template.php/val1/val2 Using PHP you can process the above URL thus:
$tmp = explode($REQUEST_URI,"template.php/"); Isn't that simple! Additional ModificationsDoesn't `template.php' show off that it is a script file? Shouldn't we camouflage it so that it looks just as a directory? If you have `.htaccess' enabled in your Apache server, you can just do that! Create a file `.htaccess' in the same directory where you place `template.php' with the following contents:
<Files template> Now rename the file `template.php' to `template'. `template' will be parsed as a PHP file. Now your URL looks more sexier: http://foo.com/template/val1/val2 That is not the only thing Apache offers! You can also completely hide the script name: http://foo.com/val1/val2 But this is a more complex procedure dealing with the Apache module MOD_REWRITE. Explaining this is beyond the scope of this article. - Subhash |
[Quick Stats: Number of main threads: 1, Number of sub-threads: 0]
Sign Guestbook
|
Who is Subhash?
The contents of this site are copyright© 2000-2008, indiWiz.com. All Rights Reserved.