![]() |
||||||||||||
|
||||||||||||
|
Razer Technology Solutions, Inc.
|
by: Dirk Brockhausen In this final part
of our tutorial we will take a look at those special directives we haven't
covered This means that you
will have to be able to edit the Apache webserver's configuration file If you wish to log
all operations effected by mod_rewrite you can activate logging with the RewriteLog
/usr/local/apache/logs/mod_rewrite_log These entries are
not written into the file ".htaccess" but in "Section 2:
'Main' server All mod_rewrite manipulations
will be logged in this file. The log file can have any name you If you wish to maintain
separate log files for individual virtual hosts, you will have to place
the <VirtualHost
192.168.1.1> (Note: If your email reader or browser wraps these lines take care to enter them unwrapped in your file!) The RewriteLogLevel
can be defined within a range of 1 to 8. Normally, 1 will do fine. Higher
levels are Another directive
which is very handy for cloaking purposes are the so-called Rewriting
Maps. These are cde2c920.infoseek.com
spider These keys are, as
you can see, hostnames or IPs. In this simplistic example the value is
always the This directive is entered either in the server section 2 or in the virtual host section 3 in file "httpd.conf": RewriteMap botBase txt:/www/yourdomain/spiderspy.txt The Rewriting Map will then be available across your server. The other directives are entered in file ".htaccess": RewriteCond ${botBase:%{REMOTE_HOST}}
=spider [OR] The conditions will
make the system check whether the required access is generated by a spider.
To this If the key is found, the value "spider" is returned and the condition is rendered as true. Next, the first RewriteRule
will be executed. This one determines that the called for ".htm"
page will be fed If the URL is called
by a normal human visitor, rule 2 applies: the user will be redirected
to page As the ".htm" pages will only be read by spiders, they can be optimized accordingly for the search engines. You may also use a
file in dbm format instead of an ordinary text file. The binary data base
format helps This example given
above offers a simple cloaking functionality. All ordinary visitors will
always be However, it does go
to show how you can effectively replace several lines of Perl code with
just a few The objective is to
present site visitors with your "Picture of the Day". Visitors
will click a link, e.g.: We will work from these server variables: TIME_MON In file ".htaccess"
we will enter the following RewriteRule ^pic.html$ pic-%{TIME_MON}-%{TIME_DAY}.html (Note: If your email reader or browser wraps this line take care to enter it unwrapped in your file!) The URL called for will be rewritten, e.g. to: pic-08-28.html So all you have to
do is upload the pertinent files once, after which you won't need to tend
to their With this final example our mod_rewrite tutorial has come to its end. Of course, we have not tackled each and every directive, variable, etc. here. Rather, we suggest
you view this tutorial as a general introduction intended to help you
as a start off point This text may freely
be republished or distributed provided the following resource box is included
intact Dirk Brockhausen is
the co-founder and principal of fantomaster.com Ltd. (UK) and fantomaster.com
GmbH
|
|
|||||
| home · services
· about us · copyright
· the eZine · contact
· customer site Copyright © Razer Technology Company 1999 - 2008. Legal Disclaimer Site Mod:1/2008. |