How to Enable mod_rewrite in Apache Server

if you are trying to make your urls ready for search engines, this tutorial will show you how to make them using apache mod_rewrite.

How to Enable mod_rewrite in Apache Server

Courtesy: Webune Linux Tutorials  

  1. Before you begin this, please make sure you make a backup copy of the original file in case you make a mistake, this way you can always go back to the original configuration - always backup before you begin doing something like this.)
  2. Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines. In Fedora you can find it at /etc/httpd/ directory.)
  3. Inside the httpd.conf file find and uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line - the # sign is for comments, by removing the # sign, you are uncommenting the line)
  4. Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out. (I didnt find these in Fedora, yet my mod_rewrite works great)
  5. After you have made the changes and saved them, restart your httpd (apache) server for the changes to take affect. The easiest way to do this is to go to the shell command and type: /etc/init.d/httpd restart (this works for Fedora, might be different for other distributions!)
  6. Done


If you want to learn how to check it mod_rewirte is enabled, check this post:

http://www.wallpaperama.com/disp-post19.html

If you did the above and still your mod_rewrite is not working read this:

How To Troubleshoot mod_rewrite in Apache Linux Server Guide

If you are hosted by a shared hosting company and dont have shell access, i suggest you contact your web hosting company. But most likely they will have some excuse for you and not change their apache configuration because they will be afraid that whatever changes they do in their server, it will affect other customers, so most likely they will not help you. Best thing to do is to host you own website. If you have cable or dsl, you can make your PC into an apache server very simple. In the future, I hope to write and share my knowlege to write a tutorial guide for building and configuring a web server for your domain website out of a simple Intel Personal Computer.

8772 - Sat Feb 02, 2013 22:11:24