SEO – Helicon Tech Blog http://www.helicontech.com/articles Web Server Enhancements Thu, 25 Jul 2013 15:33:17 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.4 http://www.helicontech.com/articles/857/ Mon, 02 Apr 2012 10:56:23 +0000 http://www.helicontech.com/articles/?p=857 Provocative SEF URLs with ISAPI_Rewrite ]]> Search Engine Friendly (SEF) URLs with Drupal http://www.helicontech.com/articles/isapi-rewrite-with-drupal/ Mon, 02 Apr 2012 09:19:43 +0000 http://www.helicontech.com/articles/?p=821 Continue reading ]]> Drupal is a very popular CMS (Content Management System) that supports SE-friendly URLs. It is designed for usage with Apache Web Server and has no default solution to use with IIS. But of course you can use this CMS with IIS Web Server and ISAPI_Rewrite will help you to enable SE-friendly URLs. This short article describes how to setup Drupal to use with ISAPI_Rewrite 3.
In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article we have used ISAPI_Rewrite 3.1.0.56 and Drupal 6.4.

Getting and Installing Drupal

You can download Drupal from official web site: http://drupal.org/. Please install Drupal according to installation instructions provided by vendor.

Please note! In the installation wizard you can see the configuration for enabling SE-friendly URLs, but with IIS you can’t use it because Drupal blocks controls as shown on this picture:

Picture 1. Configuration for SEO-friendly URLs during installation.

Please just leave it as is, it is possible to change this setting later.

Enabling SEO-friendly URLs

Please find the file %PATH_TO_DRUPAL%/sites/default/settings.php, where %PATH_TO_DRUPAL% is the root of Drupal’s installation folder. Open this document and append the code given below:

$conf[ 'clean_url' ] = 1;

Then please open .htaccess file located in the root folder of Drupal. There are many rules but only some of them are intended for ISAPI_Rewrite, others are for Apache Web Server.
Please remove all rules from .htaccess file and put these:

RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Actually these are default Drupal rules for Apache mod_rewrite configuration and we just cut them from default .htaccess file.
Done! Now you can use Drupal CMS with pretty SEO-friendly URLs.

]]>
Search Engine Friendly (SEF) URLs with WordPress http://www.helicontech.com/articles/isapi-rewrite-with-wordpress/ Mon, 02 Apr 2012 09:13:31 +0000 http://www.helicontech.com/articles/?p=815 Continue reading ]]> WordPress is state-of-the-art publishing platform with a focus on aesthetics, web standards and usability. No surprise it supports SE-friendly URLs. This short article describes how to setup WordPress for usage with ISAPI_Rewrite 3.
In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article we used ISAPI_Rewrite 3.1.0.56 and WordPress 2.6.2.

Getting and Installing WordPress

You can download WordPress from this web page: http://wordpress.org/download/.

Please don’t use versions lower than 2.6.1, because they will not work properly with ISAPI_Rewrite 3.

After downloading please install WordPress according to the installation instructions by the vendor. Note that in the installation wizard you may allow your blog to appear in search engines. This action enables indexing and will probably be important for you.

Picture 1. Enable indexing.

Enabling SE-friendly URLs

By default SE-friendly URLs are disabled. To enable this feature please go to WordPress administration panel. On the main page of administration panel please select “Settings” tab:

Picture 2. “Settings” tab.

Now please select “Permalinks” tab. On the opened page you can see some default schemes of prettifying your URLs.

Picture 3. “Permalinks” tab.

You may choose necessary scheme but notice that WordPress doesn’t use .htaccess file and ISAPI_Rewrite to process these permalinks. You will need to write your own rules.

Writing rules for .htaccess

Let’s write some simple rules for WordPress using ISAPI_Rewrite. Open “Permalinks” configuration as described above. Select “Custom Structure” radio box, and in adjacent field write /%post_id%/%postname% as shown on this picture:

Picture 4. “Custom Structure” field.

Please save changes. %post_id% and %postname% are special tag names. You can read more about tags here: http://codex.wordpress.org/Using_Permalinks. So we have configuration for URLs like http://domain.com/1/my-great-post, and now we need to write some rules in .htaccess file. Please create .htaccess file in the root folder of WordPress and write the following code into it:

RewriteBase / 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(\d+)/[^/]+/?$ index.php?p=$1 [NC,L]

These rules rewrite requests like /1/my-great-post to those like index.php?p=1, but only if no such physical file of folder exist.
Done! Now you can use your WordPress blog with pretty URLs!

]]>
Search Engine Friendly (SEF) URLs with Mambo CMS http://www.helicontech.com/articles/isapi-rewrite-with-mambo/ Mon, 02 Apr 2012 09:01:47 +0000 http://www.helicontech.com/articles/?p=806 Continue reading ]]> Mambo is the very popular CMS (Content Management System) that supports SEO-friendly URLs. t is designed for usage with Apache Web Server, and it has no default solution to use with IIS and ISAPI_Rewrite. But of course you can use this CMS with IIS Web Server, and ISAPI_Rewrite will help you to enable SE-friendly URLs. This short article describes how to setup Mambo to use with ISAPI_Rewrite 3. In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article we used ISAPI_Rewrite 3.1.0.56 and Mambo 4.5.6.

Getting and Installing Mambo

You can download Mambo from this page: http://mambo-code.org/gf/project/mambo/frs/. After downloading please install Mambo according to installation instructions provided by vendor.

Enabling SE-friendly URLs

By default SE-friendly URLs are disabled. To enable this feature please go to Mambo administration panel. On the main page of administration panel please select “Global Configuration”

Picture 1. Mambo’s administration panel.

On the opened page you can see few tabs. Please find “SEO” tab and select it:

Picture 2. “SEO” tab.

Now you can see the configuration for SEO. Please select “yes” for option “Search Engine Friendly URLs”. Then apply and save your settings. Also please go to Mambo installation folder and rename htaccess.txt file to .htaccess.

Picture 3. SEO configuration

Now all URLs on your site are SE-friendly. But the navigation will not work properly. It happens because Mambo uses variable $_SERVER[ ‘REQUEST_URI’ ] which is not supported by IIS.

Patching Mambo

You will need to make a little fix in the Mambo’s source code. Please copy this code to clipboard:

if ( isset( $_SERVER[ 'HTTP_X_REWRITE_URL' ] ) ) {   $_SERVER[ 'REQUEST_URI' ] = $_SERVER['HTTP_X_REWRITE_URL' ]; }

Now you need to find index.php file in the root of Mambo installation folder. Please open this document with any editor and paste the above code at the top of index.php as shown on this picture:

Picture 4. Patched index.php

Done! Now you can use Mambo CMS with pretty SE-friendly URLs. This article describes how to use Mambo with its default rules in .htaccess file, but of course you may replace them.

]]>
Search Engine Friendly (SEF) URLs for phpBB http://www.helicontech.com/articles/search-engine-friendly-sef-urls-for-phpbb/ Wed, 21 Mar 2012 14:32:53 +0000 http://www.helicontech.com/articles/?p=777 Continue reading ]]> phpBB is the most popular bulletin board engine at the moment. It offers fantastic set of features but unfortunately Search Engine Friendly (SEF or SEO) URLs is not among them. Why you may need to have SEF URLs for your phpBB forum? Because Search Engines give higher rank for pages with keywords in links. Forum is usually a great traffic generator for your web site and by using SEF URLs you can significantly increase its search engine ranking. Additionally these URLs are more pleasant for human eyes since contain readable and understandable keywords and look cleaner.

By default URLs in phpBB are not search or human friendly. So here you can find simple solution how to turn this http://www.example.com/viewtopic.php?f=46&t=212 into this http://www.example.com/Search_Engine_Friendly_URLs_212.html

Our solution is to use Helicon Ape with mod_seo module. Unfortunately Apache does not have mod_seo module, so to use this solution you will need to have phpBB running on Microsoft IIS  web server and install Helicon Ape on it. You can download latest version of Helicon Ape here.

mod_seo is a generic module that allows to modify (grep) portions of HTML output on the fly by using filters and regular expressions. Along with other features provided by Helicon Ape, like rewrite rules, conditions and database key-value maps it turns into a very powerful instrument for SEO. Various forums, blogs, shops and other services with dynamic content can be easily optimized for search engines with this module.

mod_seo can extract all links on the page, compare these links with regular expression patterns, find matching links, extract forum and post numeric IDs from these links, connect to existing forum database, get human readable and keyword reach topic names form database by IDs and then write modified links back to the HTML page before it gets to the user. Then mod_rewrite rules can be used to rewrite URLs back when user requests using these modified links. Main advantage of this technique is that it does not require any change to the forum source code. This means that you do not lose ability to upgrade your forum in future and use standard packages from the code vendor.

So what you need to do to get it working. Suppose you already have phpBB running on Microsoft IIS server. Install Helicon Ape on the server. You can find installation instructions here. By default Helicon Ape will be enabled for all sites on the server, so you may just create .htaccess file in your phpBB folder and put the following content into it:

 


# Enable mod_rewrite and mod_seo for current location
RewriteEngine On
SetEnv mod_seo

# Connect to database
DBDriver mssql
DBDParams "Data Source=(local)\SQLEXPRESS;Initial Catalog=phpbb;User ID=sa;Password=123456"

# Prepare SQL queries to find topic or forum name by ID
DBDPrepareSQL "SELECT forum_name FROM phpbb_forums WHERE forum_id=@KEY" getBBForum
DBDPrepareSQL "SELECT topic_title FROM phpbb_topics WHERE topic_id=@KEY" getBBTopic

# Declare database rewrite maps
RewriteMap BBForum dbd:getBBForum
RewriteMap BBTopic dbd:getBBTopic

# Needed to make strings URL-safe
RewriteMap slug int:slug

# SEO rules to change topic links on pages:

# viewtopic.php?f=46&t=2151&start=15 -> Topic_Title-46-215.html?start=15
SeoRule viewtopic.php\?f=(\d+)\&t=(\d+)(?:&start=(\d+))?$ \
    ${slug:${BBTopic:$2}}-$1-$2.html(?3\?start=$3) [Redirect, Scope=A]

# viewtopic.php?f=6&t=3&p=28#p28 -> Topic_Title-46-215.html?p=23#p=23
SeoRule viewtopic.php\?f=(\d+)\&t=(\d+)\&p=(\d+)$ \
    ${slug:${BBTopic:$2}}-$1-$2.html(?3\?p=$3) [Redirect, Scope=A]

# Check for possible incorrect topic name and redirect to prevent duplicate content
RewriteCond ${slug:${BBTopic:$3}}#$1 ^([^#]+)#(?!\1).+
RewriteRule ^(.+?)-(\d+)-(\d+)\.html$ %1-$2-$3.html [NC,R=301,L]

# Rewrite topic URLs back
RewriteRule ^.+-(\d+)-(\d+)\.html$ viewtopic.php\?f=$1&t=$2 [NC,QSA,L]

# SEO rules to change forum links on pages:

# viewforum.php?f=6&start=100 -> viewforum-Helicon-Zoo-6.html
SeoRule viewforum.php\?f=(\d+)(?:&start=(\d+))?$ \
    ${slug:${BBForum:$1}}-$1.html(?2\?start=$2) [Redirect, Scope=A]

# viewforum.php?f=8&sid=xxxxx -> viewforum-Helicon-Zoo-6.html?sid=xxxx
SeoRule viewforum.php\?f=(\d+)&sid=(\w+)?$ \
    ${slug:${BBForum:$1}}-$1.html?sid=$2 [Redirect, Scope=A]

# Check for possible incorrect forum name and redirect to prevent duplicate content
RewriteCond ${slug:${BBForum:$2}}#$1 ^([^#]+)#(?!\1).+
RewriteRule ^(.+?)-(\d+)\.html$ %1-$2.html [NC,R=301,L]

# Rewrite forum URLs back
RewriteRule ^.+-(\d+)\.html$ viewforum.php\?f=$1 [NC,QSA,L]

 

Don’t forget to use your database user name and password to connect. We are using SQL Server Express as a database for phpBB. For MySQL database connection string may look like this:

 

DBDriver mysql "MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
DBDParams "Data Source=server;Initial Catalog=database; User ID=database;Password=password"

 

The rules above are rather generic and you may want to change them to better meet your specific needs. Nevertheless, after putting them into the .htaccess file SEF URLs on your phpBB forum should immediately start working. New links will appear on forum pages and old links will be redirected to the new format to prevent duplicate content penalty. You can try example of mod_seo optimized phpBB on our community forum.

Hope you will enjoy this solution and wish you highest search rankings!

]]>
Search Engine Friendly (SEF) URLs with Joomla http://www.helicontech.com/articles/isapi-rewrite-with-joomla/ Fri, 02 Mar 2012 08:49:35 +0000 http://www.helicontech.com/articles/?p=799 Continue reading ]]> Joomla is a very popular CMS (Content Management System) that supports SE-friendly URLs. It is designed for usage with Apache Web Server, and it has no default solution to use with IIS and ISAPI_Rewrite. But of course you can use this CMS with IIS Web Server, and ISAPI_Rewrite will help you to enable SE-friendly URLs. This short article describes how to setup Joomla to use with ISAPI_Rewrite 3. In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article, we used ISAPI_Rewrite 3.1.0.56 and Joomla 1.5.6.

Getting and Installing Joomla

You can download Joomla from official web site: http://joomla.org/download.html. After downloading please install Joomla according to installation instructions provided by vendor.

Enabling SE-friendly URLs

By default SE-friendly URLs are disabled. To enable this feature please go to the administration panel of Joomla. On the main page of administration panel please select “Global Configuration”

Picture 1. Joomla’s administration panel.

On the opened page you can see the group-box called “SEO Settings”. Please select “yes” for options “Search Engine Friendly URLs” and “Use Apache mod_rewrite”. Then apply and save your settings. Also please go to Joomla installation folder and rename htaccess.txt file to .htaccess.

Picture 2. Configuration for SEO-friendly URLs.

Now all URLs on your site are SE-friendly. But there are some hurdles left. When you type different URLs in the address bar you always end up with the main page. It happens because Joomla uses variable $_SERVER[ ‘REQUEST_URI’ ] which is not supported by IIS.

Patching Joomla

You will need to add a little fix in the Joomla’s source code. Please copy this code to clipboard:

if ( isset( $_SERVER[ 'HTTP_X_REWRITE_URL' ] ) ) { $_SERVER[ 'REQUEST_URI' ] = $_SERVER['HTTP_X_REWRITE_URL' ]; }

Now you need to find index.php file in the root of Joomla installation folder. Open this document with any editor supporting Unix format (e.g. WordPad). Note: you can’t use Notepad to edit index.php because Notepad does not support saving in Unix format. Paste code above at the top of index.php as shown on this picture:

Picture 3. Patched index.php.

Done! Now you can use Joomla CMS with pretty SE-friendly URLs. This article describes how to use Joomla with its default rules in .htaccess file but of course you may replace them.

]]>
Keyword reach URLs in 5 minutes http://www.helicontech.com/articles/mod_seo/ http://www.helicontech.com/articles/mod_seo/#comments Tue, 06 Jul 2010 13:52:00 +0000 http://localhost:85/blog/?p=73 Continue reading ]]> This article is an introduction as well as a detailed guide to new mod_seo module being an integral part of Helicon Ape 3 which is destined to build good-looking URLs based on the application’s DB data or maps without necessity to change anything in its code.

Search Engine Optimization usually means a set of measures to improve web site performance for search engines, and one popular instrument for large electronic sites like forums, blogs, e-shops is Search Engine Friendly (SEF) URLs or Keyword Reach URLs. Such URL usually implies that you will see something like http://www.mysite.com/my_cool_product_name.html in the address bar instead of http://www.mysite.com/products.asp?pid=5568290. Search engines use such keywords in links to better rank pages with these keywords for search requests. Nowadays many web applications support Keyword Reach URLs either internally or by means of mod_rewrite but anyway application level support is required. Many other applications like, for example, version of WebWiz forum we are using on our web site, do not support keywords in links, so we have invented mod_seo to fill in this gap.

The idea is quite easy. Web applications like forums or blogs usually use database to store topics, posts and articles, identify posts by some IDs and use these IDs in links. This database already exists and we can easily connect to it and bind these IDs to the topic titles, where all these valuable keywords are stored.

mod_seo introduces only one directive – SeoRule – with the syntax very close to that of RewriteRule directive in mod_rewrite, but SeoRule rewrites links on pages instead of rewriting requested URLs. Together with RewriteRule and RewriteMap directives and database support (already built into Helicon Ape engine) we can make a configuration to retract keywords from database, put these keywords in the links on pages and then navigate user around the site without changing a single line of code in the web application (forum in our case).

Now we will show you how to turn this http://www.helicontech.com/forum/forum_posts.asp?TID=15116 into this http://www.helicontech.com/forum/15116-RewriteMap_and_RewriteRule_and_querystring.html step by step using our live forum as example.

What we do:

  1. Make sure mod_rewrite, mod_dbd and mod_seo modules are enabled in httpd.conf
    Enabling Helicon Ape modules
  2. Put the following lines into .htaccess in the root of our site:
    DBDriver mssql
    # include DBDParams
    DBDParams "Data Source=(local)\SQLEXPRESS;Initial Catalog=WebWizForum;User ID=sa;Password=*****"
    DBDPrepareSQL "SELECT [Subject]     FROM [WebWizForum].[dbo].[tblTopic]  WHERE [Topic_ID] =@KEY" \
                  getSeoTopic
    DBDPrepareSQL "SELECT [Forum_name]  FROM [WebWizForum].[dbo].[tblForum]  WHERE [Forum_ID] =@KEY" \
                  getSeoForum
    
    RewriteMap SeoTopic dbd:getSeoTopic
    RewriteMap SeoForum dbd:getSeoForum
    RewriteMap slug int:slug
    
    #SEO-ing
    SeoRule forum_topics\.asp\?FID=(\d+)\&title=([^\s"'$&]*) \
            forum$1-$2.html [Redirect,Scope=A]
    SeoRule forum_topics.asp\?FID=(\d+)&PN=(\d+)$ \
            forum$1-${slug:${SeoForum:$1|not-found}}-$2.html [Redirect,Scope=A]
    SeoRule forum_topics.asp\?FID=(\d+)$ \
            forum$1-${slug:${SeoForum:$1|not-found}}.html [Redirect,Scope=A]
    
    SeoRule forum_posts.asp\?TID=(\d+)\&title=([^\s"'$&]*)(?:&(get=last#\d+))? \
            $1-$2.html?4\?$4 [Redirect,Scope=A]
    SeoRule forum_posts.asp\?TID=(\d+)(?:\&PN=(\d+)\&TPN=(\d+))?(?:&(get=last#\d+))?$ \
            $1-${slug:${SeoTopic:$1|not-found}}(?2-$3).html?4\?$4 [Redirect,Scope=A]
    
    #rewrite to the original ones
    RewriteRule forum(\d+)-.*(?:-(\d+))\.html$ /forum/forum_topics.asp\?FID=$1&PN=$2 [NC,QSA,L]
    RewriteRule forum(\d+)-.*\.html$ /forum/forum_topics.asp\?FID=$1 [NC,QSA,L]
    
    RewriteRule (\d+)-.*(?:-(\d+))\.html$ /forum/forum_posts.asp\?TID=$1&TPN=$2 [NC,QSA]
    RewriteRule (\d+)-.*\.html$ /forum/forum_posts.asp\?TID=$1 [NC,QSA]

Now with explanations:

First we need to declare database maps (RewriteMap with database connection) to use in link replacing rule.

  • Declare Microsoft SQL Server driver:
    DBDriver mssql
  • And include DBDParams string for correct SQL connection
    DBDParams "Data Source=(local)\SQLEXPRESS;Initial Catalog=WebWizForum;User ID=sa;Password=*****"
  • Prepare SQL queries to select proper fields (topic/forum name) from corresponding tables of the forum database. I was using Microsoft SQL Server Management Studio to do this. Though any database management tool will do. A ‘@KEY’ in the query has a special meaning and will be substituted by the key value when map call is executed. Declaration is needed to assign names for the queries to refer to them in RewriteMap declaration. We have choosen getSeoTopic and getSeoForum as names for them.
    DBDPrepareSQL "SELECT [Subject]     FROM [WebWizForum].[dbo].[tblTopic]  WHERE [Topic_ID] =@KEY" \
                  getSeoTopic
    DBDPrepareSQL "SELECT [Forum_name]  FROM [WebWizForum].[dbo].[tblForum]  WHERE [Forum_ID] =@KEY" \
                  getSeoForum

    Topics table and corresponding SELECT query
    Topics table and corresponding SELECT query

    Forums table and corresponding SELECT query
    Forums table and corresponding SELECT query

  • Now declare database-driven maps using previously declared queries. These maps will be referred to in subsequent SeoRule directives by their names – SeoTopic and SeoForum.
    RewriteMap SeoTopic dbd:getSeoTopic
    RewriteMap SeoForum dbd:getSeoForum
  • Define slug map that is used to remove special characters from topic names to make our links more friendly for browsers and user eyes.
    RewriteMap slug int:slug
  • Now it is time for SeoRule directives.
    New URL format for main forum pages includes the forum number FID and the forum name taken from the database: http://www.helicontech.com/forum/forum11-Helicon_Ape.html
    [Redirect] flag forces requests to old-style links to be redirected to new analogues (for the above link it’s http://www.helicontech.com/forum/forum_topics.asp?FID=11)
    [Scope=A] says mod_seo to search and replace URLs in tags only
    SeoRule forum_topics.asp\?FID=(\d+)&PN=(\d+)$ \
            forum$1-${slug:${SeoForum:$1|not-found}}-$2.html   [Redirect,Scope=A]
    SeoRule forum_topics.asp\?FID=(\d+)$ \
            forum$1-${slug:${SeoForum:$1|not-found}}.html   [Redirect,Scope=A]
  • New URL format for topic pages includes the topic number TID (as the topic name is not unique) and the topic name taken from the db: http://www.helicontech.com/forum/10000-ISAPI_and_ZEND_Framework.html
    [Redirect] flag will deal with its ancestor: http://www.helicontech.com/forum/forum_posts.asp?TID=10000)
    SeoRule forum_posts.asp\?TID=(\d+)(?:\&PN=(\d+)\&TPN=(\d+))?(?:&(get=last#\d+))?$ \
            $1-${slug:${SeoTopic:$1|not-found}}(?2-$3).html?4\?$4   [Redirect,Scope=A]
  • As the forum engine doesn’t understand the new URL format, we use rewriting to convert it to habitual one, e.g. http://www.helicontech.com/forum/forum_posts.asp?TID=10000 for forum topics
    RewriteRule ^forum/forum(\d+)-.*(?:-(\d+))\.html$ /forum/forum_topics.asp\?FID=$1&PN=$2 [NC,QSA,L]
    RewriteRule ^forum/forum(\d+)-.*\.html$ /forum/forum_topics.asp\?FID=$1 [NC,QSA,L]

    and for forum posts

    RewriteRule ^forum/(\d+)-.*(?:-(\d+))\.html$ /forum/forum_posts.asp\?TID=$1&TPN=$2 [NC,QSA]
    RewriteRule ^forum/(\d+)-.*\.html$ /forum/forum_posts.asp\?TID=$1 [NC,QSA]
  • The result is a page like this:
    Forum with mod_seo enabled

The pleasant thing is you don’t need to change anything in your application — mod_seo and mod_rewrite take care of all cycle of transformations and you just enjoy the SEF picture.

Same technique can be used for many other database driven applications like forums, blogs or e-shops. Existing database may be used to transform links or new maps can be created.

If you need assistance with doing same thing for your application, you can get a Premium Support Plan from us and our support team will be happy to tailor a custom solution for you!

Best regards,
Yaroslav, Anton — HeliconTech Team

]]>
http://www.helicontech.com/articles/mod_seo/feed/ 9
ISAPI_Rewrite3 vs LinkFreeze – which is better? http://www.helicontech.com/articles/isapi_rewrite3-vs-linkfreeze-which-is-better/ http://www.helicontech.com/articles/isapi_rewrite3-vs-linkfreeze-which-is-better/#comments Thu, 18 Mar 2010 13:47:00 +0000 http://localhost:85/blog/?p=69 Continue reading ]]> From time to time we get the questions of this kind on our forum/email, so I guess it’s time to show the difference to everyone.

  1. Ease of use
    LinkFreeze is the unquestionable leader by this parameter. One dialog is everything you’ll deal with – all settings are set up there.

    ISAPI_Rewrite in its turn is far more complex tool – you need to be aware of (at least) the basics of regular expressions to manage it. Most of the configuration is stored in plain text files which may be edited in a special manager.

  2. Functionality
    In this characteristic the situation is quite the contrary – ISAPI_Rewrite has incomparably more features than LinkFreeze, notably:
    rewriting URLs in any way you want (e.g. having www.domain.com/seo_page-123.html refer to www.domain.com/real_page.aspx?param_id=123);
    proxying (e.g. having www.external.com/any_page.html refer to www.internal.com/any_page.aspx);
    mapfiles support (e.g. having www.domain.com/seo_page-param_name.html refer to www.domain.com/real_page.aspx?param_id=123);
    filtering requests based on server variables’ values, IP addresses/domain names, referers, etc.LinkFreeze is achieving SEO-friendliness in a different way – it allows to make query string a part of the URL, move and change file extension (e.g. having www.domain.com/page_name-param_name-123.html refer to www.domain.com/page_name.aspx?param_name=123) but the wording of the URL remains intact (addition/replacement/deletion of URL portions is not possible).
  3. SEO efficiency
    While LinkFreeze will automatically make your links on pages look like www.domain.com/page_name-param_name-123.html, with ISAPI_Rewrite3 you need to either alter them manually to look like www.domain.com/seo_page-param_name.html or use 301 redirects (this may slightly decrease the pagerank of the page) to SEO-friendly page names and reverse internal rewriting to the actual page name. Here’s how it looks like in terms of ISAPI_Rewrite 3 syntax:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{QUERY_STRING} ^param_id=(\d+)$
    RewriteRule ^real_page\.aspx$ seo_page-%1.html? [NC,R=301,L]
    RewriteRule ^seo_page-(\d+)$ real_page.aspx?param_id=$1 [NC,L]

    So, the key difference is that LinkFreeze changes links on pages and ISAPI_Rewrite doesn’t!

  4. Windows versions supported
    LinkFreeze supports Windows NT 4 (IIS 4), Windows 2000 (IIS 5), Windows XP (IIS 5.1) and Windows 2003 (IIS 6).ISAPI_Rewrite3 supports Windows 2000 (IIS 5), Windows XP (IIS 5.1), Windows 2003 (IIS 6), Windows Vista (IIS 7), Windows 2008 (IIS 7), Windows 7 (IIS 7.5) and Windows 2008 R2 (IIS 7.5).

    If you are the lucky user of IIS7 (7.5) and need ISAPI_Rewrite/LinkFreeze capabilities, you can benefit from using Helicon Ape tool which includes mod_rewrite and mod_linkfreeze as well as a bunch of other helpful modules and functions.

Hope this article favored better understanding of the products capabilities and peculiarities, and you choice will be more conscious.

Best regards,
Anton, Helicon Tech

]]>
http://www.helicontech.com/articles/isapi_rewrite3-vs-linkfreeze-which-is-better/feed/ 2
Introduction to database functionality of Helicon Ape http://www.helicontech.com/articles/introduction-to-database-functionality-of-helicon-ape/ http://www.helicontech.com/articles/introduction-to-database-functionality-of-helicon-ape/#comments Fri, 22 Jan 2010 12:57:00 +0000 http://localhost:85/blog/?p=61 Continue reading ]]> Hello,
New release of Helicon Ape has come out right after winter holidays. We wanted to fix a few found bugs and satisfy users’ feature requests. However we also had a desire to bring something new and useful. So here you go—Helicon Ape v3.0.0.30 obtained database functionality. This means Ape has a potential to work with almost any RDBMS. Let’s
provide you with a little explanation. Please note, this article isn’t aimed to give you deep technical information or instruction steps. If you want these please consider “mod_dbd: Saying technically” and “How to connect mod_dbd with various databases”.

mod_dbd

As well as Apache, Ape uses mod_dbd module as an interface to databases. The module organizes interaction between Ape and database drivers through which Ape modules may operate.
Though such database-driven modules are going to be your tools for doing some magic stuff on your server, you should configure mod_dbd to specify database driver, connection options and setup connection pooling. “How to connect mod_dbd with various databases” article will help you in this. Here are the basic features of mod_dbd:

  • Compatibility with original Apache mod_dbd module;
  • Configurable connection pooling which allows organizing connections in a very efficient way;
  • Native support for Microsoft SQL Server and Oracle;
  • ODBC and OLEDB interfaces support;
  • Possibility to load any ADO.NET compatible connector.

The following sections describe the modules we have already bound with mod_dbd.

mod_authn_dbd

This module is basically the same as mod_authn_file. The only difference as you may guess is that mod_authn_dbd retrieves credentials from a database. To make it working you should specify an SQL query because we don’t know your database structure and it’s not supposed to be limited to mod_authn_dbd needs.
The configuration below demonstrates mod_authn_dbd in action:

DBDriver mssql
DBDParams "Data Source=db_server;Initial Catalog=users_db;  Persist Security Info=True;User ID=sa;Password=your_password"
# core authentication and mod_auth_basic configuration
# for mod_authn_dbd
AuthType Basic
AuthName "My Server"
AuthBasicProvider dbd
# core authorization configuration
Require valid-user

# mod_authn_dbd SQL query to authenticate a user
AuthDBDUserPWQuery "SELECT password FROM users_table   WHERE user = @USERNAME"

As you may notice the code starts with two mod_dbd directives—DBDriver and DBDParams. Both are required for mod_dbd to work correctly, whereas others may be omitted.
These mod_dbd directives are needed to specify desired database driver and connection string. In the example above we’re connecting to Microsoft SQL Server. AuthBasicProvider dbd points to database-based authentication and finally SQL query is set through a special mod_authn_dbd directive AuthDBDUserPWQuery.

Map-files in mod_rewrite

This is probably one of the most exciting features. Before you would tell your web-site engine to regenerate a map-file according to database content. Now you have a possibility to appeal to the database directly and this is very easy to do:

DBDriver mssq
lDBDParams "Data Source=server;Initial Catalog=database;  User ID=user;Password=password"
DBDPrepareSQL "select OriginalURL from seo_mapping   where `SEO_URL`=@KEY" seo_map_select

RewriteEngine On
RewriteMap map_dbd dbd:seo_map_select
RewriteCond ${map_dbd:$1|NOT_FOUND} (.*)
RewriteCond %1 !NOT_FOUND
RewriteRule (.+) %1 [L]

As opposed to mod_authn_dbd, mod_rewrite doesn’t introduce any special directive for SQL query setup. Instead it uses DBDPrepareSQL which belongs to mod_dbd. DBDPrepareSQL links the query with the unique name and you should use this name in RewriteMap declaration. The rest of the rules should be familiar to you if you worked with map-files before.

Summary

We have considered a brand new feature of Ape—database connectivity. Along with core database module—mod_dbd—we’ve also touched upon mod_authn_dbd and mod_rewrite. Frankly saying this is not a limit and hopefully Ape will have loads of others database-oriented features. We’ll be accumulating customers’ requests and will try and implement the desired functionality. Thanks for your cooperation.

Yours sincerely,
Helicon Tech team.

]]>
http://www.helicontech.com/articles/introduction-to-database-functionality-of-helicon-ape/feed/ 54
Go for SEO with Helicon Ape mod_linkfreeze http://www.helicontech.com/articles/seo-with-helicon-ape-mod_linkfreeze/ http://www.helicontech.com/articles/seo-with-helicon-ape-mod_linkfreeze/#comments Tue, 18 Aug 2009 14:07:00 +0000 http://localhost:85/blog/?p=49 Continue reading ]]> Intro

SEO, SE-friendly, search engine marketing — these words are driving mad lots of people today.Everyone wants to be SE-friendly. According to the Wikipedia, search engine optimization (SEO) isthe process of improving the volume or quality of traffic to a web site from searchengines via «natural» («organic» or «algorithmic») search results.In other words, SEO simplifies search robots’ job thus bringing the web site to the top of the search results.Having got the idea, you would probably like to use that technique everywhere. Any new web-site of yours will be optimized for search engine.And that’s pretty good, but not good enough. We’ve missed something here, huh? What about existent sites?What if they are really huge and require loads of code modifications. Are they doomed to have stupidlinks like index.php?id=123? Do you need to spend loads of hours tinkering with a source code? Definitely NO!Right here we are going to show you an easy and powerful way to let SEO in your server without significant effort.Luckily Helicon Ape just got all needed features.

mod_linkfreeze

Like its elder brother mod_linkfreeze provides extended toolsetfor changing links on pages to SE-friendly format. So, in general «freezing» idea is based on HTML content modification. Once you’ve written special rules,the module would carefully modify every hyperlink inside each web-site page if the link matches the rules pattern(s). In a word, mod_linkfreeze turnsdynamic links to the static ones. It is a primary idea of the module and at the same time a good SEO practice as long as searchrobots work much better with static references. And the most interesting thing here — you don’t need to modify any part of existent code.Basic concept is depicted on this scheme:

The scheme reflects the whole life cycle of a request. As you can see user goes to a web-site and IIS serves the request through the web-site engine.It doesn’t matter what the engine is. It can be Wordpress, CakePHP or even simple HTML. The important part is that the engine returns HTMLresponse within hyperlinks and then mod_linkfreeze catches and processes the response according to its rules.Dynamic links become static and the user finally gets requested page. Without mod_linkfreeze the step inside theorange rectangle won’t exist.

You may be wondering why we expect only IIS7 on the server (see the scheme). Bad news for Windows 2003 owners — mod_linkfreeze doesn’t work under IIS6.It’s just technically impossible and we hope you will enjoy mod_linkfreeze on Windows 2008 Server.

Well, let the theoretical stuff blow away and make something real — move further and demonstrate the module dealing with a real web application.

Freezing phpBB — the online forum engine

We decided to play with a forum engine because forums usually contain tons of dynamic links.Although we’ve taken phpBB, you may use another web-application as far as the article describesmod_linkfreeze in general.

The forum links right after installation look like this:

As you can see, there are dynamic links to PHP scripts which we want to make static. Let’s enable mod_linkfreeze.First of all we have to make sure the following line is uncommented in the server configuration (httpd.conf):

LoadModule linkfreeze_module   modules/mod_linkfreeze.so

Then we should enable linkfreeze filter. The easiest way is to write the following in httpd.conf:

SetOutputFilter linkfreeze

You may try mod_mime as well, setting up the filter on a specific extension only:

AddOutputFilter linkfreeze .php

Well, now we should edit .htaccess file in the root folder of phpBB and update it as follows:

LinkFreezeEngine on

Although that wasn’t actually required. LinkFreezeEngine is switched on by default. However you may use this directiveto disable the module in specific context. For example you may use mod_linkfreeze for several locations only:

LinkFreezeEngine Off
<Location /foo/>
        LinkFreezeEngine on
        ...
</Location>

<Location /bar/>
        LinkFreezeEngine on
        ...
</Location>

LinkFreezeRule is the magic and power of mod_linkfreeze. This directive controls the whole process of «freezing».Basic syntax is described in the documentation.Let’s see what happens if we try this:

LinkFreezeEngine on
LinkFreezeRule --- php=html

Wow, great! It works. Two simple lines and we have static links. They don’t look pretty enough yet, but firstly we will sort out what’s going on and then will try to get better result.

So there are three hyphens straight after LinkFreezeRule. Do you remember that dynamic links have three separators as usual? The first is a question mark (?) for query string separation, the second is ampersand (&) for query string arguments separation and the third is equality sign (=) which separates arguments names and their values. Three hyphens are needed exactly to replace these separators in the following order: ?&=. We decided to use hyphens but it wasn’t necessary.

Note! It is advisable to use rarely used symbols as replacement characters, otherwise conflicts with the same characters in the URLs are inevitable. We recommend the following combinations: —, ~~~, !!!, |||, ===, ///.The characters may also be combined, e.g.: -=-, !/=, etc.

Next part of the rule is php=html. Obviously it means extension replacing from ‘php’ to ‘html’. You might decide touse something more funny:

LinkFreezeEngine on
LinkFreezeRule --- php=aspx

The links are static but look very weird. Query string arguments go right after the extension. Moreover we want to be sure all referenceshave lower case. For these cases LinkFreezeRule supports optional flags.MoveExt moves file extension and LowerCase casts a link into lower case. Let’s try it:

LinkFreezeEngine on
LinkFreezeRule --- php=aspx [MoveExt, LowerCase]

Oh no. Our session expired while we were writing previous paragraph and phpBB added some strange argument ‘sid’. It has goneafter second page reloading, but we should expect the argument again. What can we do? Happily mod_linkfreeze prepared anotheruseful flag for us — Params. It allows to specify only needed query string arguments for «freezing».In our case it would be like that:

LinkFreezeEngine on
LinkFreezeRule --- php=html [MoveExt, LowerCase, Params="u|g|f|p|mode|id|search_id"]

See we have only two lines of code. We didn’t modify any part of phpBB, we didn’t tweak IIS. We just wrote a few magic words.If sometime you realize you don’t need mod_linkfreeze anymore, you may just replace on with off. Huge effort, huh? 🙂

We’ve finished with phpBB. Our site is configured and ready to go on air.

The last tricks

When you setup mod_linkfreeze on your server some users will still have old bookmarks. As long as links became SE-friendly you would probably like toredirect old references to the new ones. This is beneficial for SEO as it allows to eliminate the duplicate content problem and consequent penalty in search engines. To enable redirection, please use Redirect flag:

LinkFreezeEngine on
LinkFreezeRule --- php=html [Redirect, MoveExt, LowerCase, Params="u|g|f|p|mode|id|search_id"]

Left-side screenshot displays response without Redirect flag. User gets 200. When we add the flag, user gets 301 (right screenshot).

The last thing we want to show is performance tweaking.
LinkFreezePageSizeLimit directive allows to restrict the maximum size of pages to process. mod_linkfreeze won’t do anythingwith the part of page exceeding the LinkFreezePageSizeLimit value. By the way Google also doesn’t enjoy parsing huge pages till the end.The value of directive should be specified in kilobytes:

LinkFreezePageSizeLimit 4096

And finally, NoCheckFile flag tells mod_linkfreeze not to check requested file for existence. For example if you go tohttp://site.com/static-link.html, by default mod_linkfreeze will check whether static-link.html exists on the disk and if it does, the module won’t de-freezethe link but will return the file content instead. Omitting these checks is a good idea to boost the performance BUT only in case you’re sure it won’t harm you.

Summary

Well, we’ve done a lot with tiny effort. We described how to enable mod_linkfreeze and turn dynamic links to static ones.We’ve also explained the basic idea of «freezing» and told you some useful tricks.
Hope you will enjoy Helicon Ape and mod_linkfreeze!

Yours sincerely,
HeliconTech Team

]]>
http://www.helicontech.com/articles/seo-with-helicon-ape-mod_linkfreeze/feed/ 1