Skip to main content


Apache RewriteMap with MySQL

Apache RewriteMap with MySQL

Apache rewritemap is a wonderful addon for Apache that can directly connect to a datastore and pull data dynamically. So you don’t have to depend on a scripting language (like PHP, Python) to do the rewriting/redirect for you.
Our use case was to setup “Reverse proxy” to redirect request into different subdomains based on an input URI’s parameter value. Our subdomain data are stored in MySQL tables. This is what we have done to do that,

How to enable Gzip compression in Apache

How to enable Gzip compression in Apache

The mod_deflate module provides the DEFLATE output filter that allows the output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with an older version of Apache.

Enable Gzip Module in Apache

       By default, a mod_deflate module is enabled in Apache. To make sure that it is enabled, check following line in Apache configuration file.

knackforge blog knowledge base

Apache redirect IP requests to domain name

At times Apache is configured to serve a site through IP address as well. For a production site with proper domain and things this could affect SEO due to content duplication.

Quick fix for the same could be to have a redirect rule in .htaccess file which comes by default in most of the web applications.

The below rewrite will do the trick,

RewriteCond %{HTTP_HOST} ^74\.127\.228\.193$
RewriteRule ^(.*)$$1 [L,R=301]

The first line checks if the request is posted through IP address while the second line redirects to domain name on match.


How to make Apache faster for Drupal

If you are reading this blog post you must be striving to improve the performance of your site. When we speak about performance two things should be taken into account essentially.

  1. Number of requests the site is able to serve (The more, The better)
  2. Response time per request (The least, The better)

I guess it is not much needed to stress as how essential the response time plays in deciding the success of a website. Apache the prominent Web server plays a key role in this connection.

knackforge blog knowledge base

Enabling HTTP authentication for private Drupal site

At KnackForge we try to follow best practices in all our development processes. The list includes protecting development and stage sites from unauthorized access and search engines. HTTP authentication has been the simple and prime option of our choice. The steps involved in this process is fairly minimal and depends on apache's .htaccess file. Thus needs no restart to the web server.


Subscribe to Apache