- Overview
- Installation & Uninstallation
- Local and remote management using IIS 7
- Context and processing order
- Apache compatibility
- Modules
- core functions
- mod_antibot
- mod_asis
- mod_auth_basic
- mod_auth_digest
- mod_authn_anon
- mod_authn_dbd
- mod_authn_default
- mod_authn_file
- mod_authz_default
- mod_authz_groupfile
- mod_authz_host
- mod_authz_user
- mod_cache
- mod_dbd
- mod_deflate
- mod_developer
- mod_dir
- mod_disk_cache
- mod_env
- mod_evasive
- mod_expires
- mod_filter
- mod_gzip
- mod_headers
- mod_hotlink
- mod_linkfreeze
- mod_log_config
- mod_logio
- mod_mem_cache
- mod_mime
- mod_proxy
- mod_replace
- mod_rewrite
- mod_seo
- mod_setenvif
- mod_so
- mod_speling
- mod_usertrack
- mod_xsendfile
- Articles
- Release history
- Troubleshooting
- License agreement
mod_linkfreeze
Overview
mod_linkfreeze module provides extended toolset for pattern-based transformation of links on pages to SEO-friendly format.
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 turns dynamic 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 search robots work much better with static references. And the most interesting thing here—you don't need to modify any part of existent code. The 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 HTML response 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.
WARNING: Built in IIS compression should be disabled in order for link replacement function to work. You are free to enable compression using Ape's mod_gzip module.
Quick start
-
Replace all links
http://www.exaple.com/ default.aspx?param1=valueA
tohttp://www.exaple.com/ default-param1-valueA.htm
:#put these rules into the root .htaccess file SetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [ AbsLinks,MoveExt ]
-
Freeze only FID and TID parameters , redirect old-style requests to the frozen ones,
ignore real files with *.htm extension (for better for performance):
#put these rules into the /forum/.htaccess file SetEnv mod_linkfreeze LinkFreezeRule --- "asp=htm" [ MoveExt, Redirect, NoCheckFile,Params="FID|TID" ]
This rule is useful for freezing forums (for example Web Wiz Forums engine):
http://www.helicontech.com/forum/forum_topics.asp?FID=10
→http://www.helicontech.com/forum/forum_topics-FID-10.htm
http://www.helicontech.com/forum/forum_posts.asp?TID=14366
→http://www.helicontech.com/forum/forum_posts-TID-14366.htm
where FID is Forum ID and TID is Thread ID. -
Migration from LinkFreeze product to mod_linkfreeze is easy but may be unobvious:
LinkFreeze syntax:
Corresponding mod_linkfreeze syntax:/ ~~~ [MoveExt]
SetEnv mod_linkfreeze LinkFreezeRule ~~~ "*" [ NoSort, MoveExt ]
Related articles and topics
- Go for SEO with Helicon Ape mod_linkfreeze
- mod_env module
- mod_seo module
- mod_setenvif module (extended syntax supported)
Environment variables
Name | Context | Description |
---|---|---|
mod_linkfreeze | S V D .h | forces mod_linkfreeze to start automatic links replacement on pages |
content-type-charset | S V D .h | allows to explicitly specify the charset value for Content-Type header to be used by mod_linkfreeze |
Examples
This is how you can enable mod_linkfreeze for the entire site
# put this line into the .htaccess under the root of your site
SetEnv mod_linkfreeze
and exclude /admin folder from processing by mod_linkfreeze
# put this line into the .htaccess under /admin folder
UnsetEnv mod_linkfreeze
This same behavior may be achieved with one mod_setenvif directive:
# disables mod_linkfreeze for the current context
SetEnvif request_uri !/admin mod_linkfreeze
Note!
Sometimes you'll need to explicitly specify the charset for mod_linkfreeze to use as some applications
(like PHP) reset it bypassing IIS leaving Ape modules ignorant. To override
Charset
parameter value
of
Content-Type
header use the following
SetEnv
line:
# sets Charset for mod_linkfreeze
SetEnv content-type-charset windows-1251
Exact names of charsets may be taken from here .
Directives
Name | Context | Description |
---|---|---|
LinkFreezeEngine | S V D .h | enables mod_linkfreeze functionality |
LinkFreezePageSizeLimit | S V D .h | sets maximum page size to be processed by mod_linkfreeze |
LinkFreezeRule | S V D .h | defines specific details of mod_linkfreeze behavior |
LinkFreezeEngine
Enables mod_linkfreeze for the current context. It may be useful to
disable mod_linkfreeze (
LinkFreezeEngine Off
) for the
private areas of the site (such as
/admin
,
/private
).
Syntax
LinkFreezeEngine On|Off
Default
LinkFreezeEngine On
Example
#put these rules into the httpd.conf file
SetEnv mod_linkfreeze
LinkFreezeRule --- "aspx=htm" [MoveExt]
<Location /admin>
LinkFreezeEngine off
</Location>
LinkFreezePageSizeLimit
Sets the maximum page size in kilobytes that will be processed by mod_linkfreeze; the part of page exceeding the LinkFreezePageSizeLimit value will be left as is—links in that part won't be frozen (Google also doesn't enjoy parsing huge pages till the end). If the value is set to 0, the check for page size will not be performed.
Syntax
LinkFreezePageSizeLimit 2048|value
Example
LinkFreezePageSizeLimit 4096
SetEnv mod_linkfreeze
LinkFreezeRule --- "aspx=htm" [ AbsLinks,MoveExt ]
LinkFreezeRule
Determines what links and in what way mod_linkfreeze will process. It is possible to use several LinkFreezeRule directives for the same context.
Syntax
LinkFreezeRule ?&= "old_ext=new_ext" OptionalLinkFilter [ FLAGS ]
Description
-
?&=
— any three characters allowed in filenames
that will replace "?", "&" and "=" in the URL respectively.
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.
-
"old_ext=new_ext"
—
old_ext
is the
file extension to be replaced with
new_ext
Note! You can specify "*" character in case no extension modification is necessary.
SetEnv mod_linkfreeze LinkFreezeRule --- "*"
- LinkFilter — optional parameter that allows to finely configure what types of URLs to freeze. Regular expressions are possible
Example
SetEnv mod_linkfreeze
LinkFreezeRule --- "aspx=htm" "^http://.*"
The above rule says that only URLs beginning with
http://
(absolute links) must be processed.
Flags
Flags are used to apply additional conditions to LinkFreezeRule. The following flags are available:
-
By default mod_linkfreeze does not process links in absolute format
because most of them point to external resources that won't probably be able to processed them correctly. But if A flag is specified after the rule, such links will be frozen.<a href="http://localhost/default.aspx?param=val#comment">link</a>
Note that mod_linkfreeze comparesSERVER_NAME
server variable with the host name for the link
to freeze links to local site only.<a href="http://localhost/default.aspx?param=val#comment">link</a>
- Lowercase or L — Lower case all links before transformation
-
Example
The above rule will convertSetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [ MoveExt ]
to<a href="/default.aspx?param=val#comment">link</a>
<a href="/default-param-val.htm#comment">link</a>
Example
The above rule will convertSetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm"
to<a href="/default.aspx?param=val#comment">link</a>
<a href="/default.htm-param-val#comment">link</a>
-
If the request ishttp://localhost/ default-param-val.html
and such file physically exists, mod_linkfreeze will show it.
With NoCheckFile flag after the rule
the link will be de-frozen anyway and the user will get response fromSetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [MoveExt, NoCheckFile]
http://localhost/ default.aspx?param=val
.
This is not the most reliable solution, but it works much faster because file existence check is omitted. -
NoLinks
or
NL
— Don't transform links on pages
The links on pages won't be frozen; only incoming requests will be unfrozen. -
NoRequests
or
NR
— Don't decode incoming requests
The incoming requests won't be unfrozen; only links on pages will be frozen. -
NoSort
or
NS
— Don't sort parameters in requests/links
By default is disabled, i.e. parameters will be sorted alphabetically. -
mod_linkfreeze will perform redirect to new style URL to avoid duplicate content penalty if:-
the old-format URL is requested;
Example
With the above rule in place the request toSetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [ MoveExt, Redirect ]
http://localhost/default.aspx?param=val#comment
will be 301-redirected to
http://localhost/default-param-val.html#comment
. -
the requested URL has wrong format (incorrect order of parameters; old
extension; parameters out of Params list (see below); etc.).
Example
With the above rule in place the request toSetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [ MoveExt, Redirect, Params="id|page" ]
http://localhost/default.aspx?id=val&other=val2
or
http://localhost/default-id-val-other-val2.html
will be 301-redirected to
http://localhost/default-id-val.html?other=val2
,
which means that all unwanted parameters are left outside the Google-indexed part of the URL (in the query string) and hence won't harm your pagerank.
-
the old-format URL is requested;
-
Example
With the above rule in place only "aaa" and "bbb" parameters will be frozen. So,SetEnv mod_linkfreeze LinkFreezeRule --- "aspx=htm" [MoveExt, Params="aaa|bbb"]
<a href="/default.aspx? aaa=val1 &otherParam=etc">link</a>
will become
<a href="/default- aaa-val1 .htm?otherParam=etc">link</a>
.
mod_linkfreeze performs sorting of parameters before freezing to avoid duplicate content penalty (also true for Redirect).
The script doesn't care what the order of parameters is:
But for the file-system these are different filenames that will then return the same content:<a href="/default.aspx?aaa=val&bbb=val">link</a> <a href="/default.aspx?bbb=val&aaa=val">link</a>
mod_linkfreeze guarantees the same parameters order in both cases:<a href="/default-bbb-val-aaa-val.htm">link</a> <a href="/default-aaa-val-bbb-val.htm">link</a>
<a href="/default-aaa-val-bbb-val.htm">link</a>