[Xitami] CGI Alias and Dynamic URL conversion - IT WORKS!

Russel Olinger rolinger1 at hotmail.com
Wed Jan 9 08:23:08 CET 2008


Woohooo...ok.  Apache uses mod_perl and mod_rewrite to convert dynamic URLs to static ones, but no such luck using it with Xitami.  However, you can use Xitami's CGI Alias' to do the trick.  Some of you might have known this or have figured it out previously - if so, then excuse my enthusiasm.  But if not, then read on below to learn how to do it.

This is technique is very very helpful for those who are interested in making their websites as Search Enginer Crawler friendly as possible....of all the SEO reading I have done indicates that crawlers indexing sites do not look favorably on dynamic URLs and give higher priority and consideration to static URLs - thus better ranking, higher and more frequent crawl rates.

I needed to do this because I have over 700,000 pages of content that fluctuates daily and Google wasn't getting past about 24,000 indexed pages while MSN and Yahoo were barely crawling/indexing my site at all.  80% of those looking at my site to help me figure out why my numbers were so low all pointed to my extensive dynamic URLs as being a big part of the problem.

=========
A typical Dynamic URL: 
    www.example.com/cgi-bin/foo.pl?id=12345&var1=100&var2=Hello Everyone

In what ever script you use to generate the above URL you can easily create that URL and then spit it out as a static URL

Static URL: www.example.com/foo/12345/100/hello everyone/
OR: Static URL: www.example.com/foo/id_12345/var1_100/var2_Hello Everyone

Then using Xitami's CGI Alias section create the following kind of alias link:

/foo = /xitami/cgi-bin/foo.pl

Xitami requires that /foo be the beginning of the URL...and anytime it sees /foo at the beginning, regardless of what follows it, Xitami will execute the associated script...in this case: /xitami/cgi-bin/foo.pl

Then in the actual foo.pl script you would simply need to grab the $ENV{'PATH_INFO'} and parse it....conveniently, PATH_INFO from the above static examples would be everything AFTER /foo/

Testing a simple perl script for foo.pl

#!/perl/bin/perl
@getVars = split(/\//,$ENV{'PATH_INFO'}) ; 
print "\n at getVars" ; 

#### Example 1 Returns:
12345 
100 
Hello Everyone

### Example 2 Returns:
id_12345 
var1_100 
var2_Hello Everyone

This in example 1 you would need to know the exact order of your parsed variables, but in example 2 you can include the var names as part of the variable value...I prefer the second method because then you can order your variables in any order and add as many as you want without worry of having to always know the order or worry that you didn't account for every variable needed.

Anyway...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xitami.org/pipermail/xitami/attachments/20080108/7b84baba/attachment.htm 


More information about the Xitami mailing list