web analytics

Blog

Enabling mod_rewrite in Apache 2.2

Tags: Apachemod_rewrite

Published on: December 15, 2009 by Arnold Pablo

Enabling mod_rewrite in Apache 2.2

Scenario:

The website developers generally use mod_rewrite to improve user-friendliness and search engine friendliness of websites by exposing more memorable and crawlable URLs to the users.By default in CentOS or in RHEL flavors of Linux has Apache 2.2 installed. It often becomes a requirement to mod_rewrite enable 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! Try it out and put your feedbacks in the comment box 🙂

Category : Apache, General, Troubleshooting

Arnold Pablo

Arnold Pablo

Technology always fascinated me and continues to do so. I started my career back in 2004 as a Junior System Admin and worked in various capacities both in technical and managerial roles. I love to experiment and try out new OSS projects and in free time, go for cycling to the interiors of God's own country, Kerala!

You may also read:

Comments

Add new commentSIGN IN

  • My problem was that the “AllowOverride” by default is None. I change it to all and then rewrite will work. Thank you for your post.

Let's Connect

Get new updates

Categories

$0.000 items