Enabling mod_rewrite in Apache 2.2

By default CentOS or RHEL flavours of Linux has Apache 2.2 installed. It often becomes a requirement to enable mod_rewrite on these servers. Techs who have been working with cPanel and server with control panels often finds it difficult to troubleshoot issues with a bare server. There are a few things to check or commands to execute in such case where mod_rewrite is shown enabled in the httpd.conf, but not working.

[root@cave html]# httpd -V
Server version: Apache/2.2.3

[root@cave html]# httpd -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
….
…….
….
rewrite_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_connect_module (shared)

[root@cave html]# a2enmod rewrite

a2enmod is only to be used if the rewrite_module is not enabled in httpd.conf

Check for the “AllowOverride” settings. It should be set to “All“. By default it will be “None

Things should work fine after this. Also I found a small good script to check at this URL to see whether mod_rewrite is enabled or not http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html

Good Luck guys!

Related posts:

  1. Win32 style directory indexing in apache – Date and Size along with the name
  2. Howto enable access to whm, cpanel subdomains (proxy subdomains) in cPanel
  3. Source compilation of Apache
  4. Apache Performance Tuning (Part II/III) – Editing Apache for Performance
  5. mod_php explained

Comment Form

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later