MySQL Rewrite/Redirection Module for Apache 2.x
- Description :
- Rewrite or redirect URL using an alias MySQL table.
- Module Identifier :
- sqlalias_module
- Source File :
- mod_sqlalias.c
- Compatibility :
- Apache 2.x
Summary :
Sqlalias module will intercept specific URI requests and dispatch them to the appropriate page to be served using a MySQL alias table. The MySQL alias table will hold aliases and their corresponding files. A file may have more than one alias which references to it, but an alias cannot point to more than one file.
Download
Linux version : mod_sqlalias-1.0.5.tgz
Windows version : mod_sqlalias-1.0.5.win32.zip
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Installation
After obtaining the latest version of the sqlalias module source code, change into the source directory (mod_sqlalias), and run ./configure
. To see the various ways in which you can customize your installation, run ./configure --help
.
The configure process will check your environment and prepare itself for compiling the source code. If one or more of the prerequisites cannot be found, configure will terminate with an error. You will need to resolve this and run configure again.
If configure runs without error(s), you are ready to compile. To compile mod_sqlalias, run make
. If the source code does not compile, make sure your environment is setup correctly. If you are convinced the source of the failure is mod_sqlalias, gather all relevant information about your system such as the Apache version, OS version, the configure statement you used, etc. and contact pierrick - at - webstart.fr
Once mod_sqlalias is compiled, install it by running make install
.
Configuration Directives
SQLAliasEnable
- Syntax:
- SQLAliasEnable on|off
- Default:
SQLAliasEnable off
- Context:
- server config, virtual host, .htaccess
The SQLAliasEnable
directive enables or disables the SQL Alias Engine. If it is set to off, this module does no runtime processing at all.
SQLAliasDbParam
The SQLAliasDbParam
directive allows you to configure your mysql connection. You can configure the connection to use wether a TCP connection or a Unix socket.
# Exemple if the MySQL server is a remote server SQLAliasDbParam hostname 127.0.0.1 SQLAliasDbParam username "username" SQLAliasDbParam password "password" SQLAliasDbParam database "db" SQLAliasDbParam port 3306
# Exemple if the MySQL server is a local Unix machine SQLAliasDbParam socketfile "/path/to/mysql.sock" SQLAliasDbParam username "username" SQLAliasDbParam password "password" SQLAliasDbParam database "db"
SQLAliasQuery
The SQLAliasQuery
directive defines the MySQL query that will be executed to get the rewrited URI. The first returned column must be the rewrite/redirect address for your source (this can be a relative path or an URI). The second column (not mandatory) is the apache HTTP response code.
# Exemple SQLAliasQuery "SELECT destination, code FROM table WHERE source='%s' LIMIT 1"
SQLAliasFilter
The SQLAliasFilter
directive define filters. If the URI matches one of them, the rewriting will not take place. The directive can occur more than once, with each instance defining a filter.
# Exemple SQLAliasFilter \.(jpg|png|gif|css|swf)$