Skip to content

How to Check if mod_rewrite is Enabled on your Server

Here's a tip I thought I would share. Many of the open source applications that are currently available rely on an Apache module called mod_rewrite to rewrite requested URL's on the fly. Applications such as Mambo rely on mod_rewrite being present and enabled on a server in order to produce Search Engine Friendly URL's.

Here is a way to check if mod_rewrite is enabled on your server...

  • Create a file called .htaccess (note there is nothing before the file extension).
  • Put only these two lines in your .htaccess file.
    Options +FollowSymLinks
      Redirect /google.html http://www.google.com
  • Upload this file to your site root on your server.
  • Now point your browser to: http://www.example.com/google.html (replacing example.com with the domain name of your own website).

If you are redirected to Google, mod_rewrite is working.
If you get an error, then mod_rewrite is not working.

If mod_rewrite is not working, check Apache configuration.

Apache requirements for mod_rewrite

The Apache httpd.conf file has the settings to enable URL rewriting.
Two settings are required.

  • mod_rewrite module is installed
    Search file for LoadModule rewrite_module and un-comment that line (remove the leading #)
  • AllowOverride All
    Search file for AllowOverride None and change it to AllowOverride All

Restart Apache
Restarting the Apache web server is required for the changes to take effect.

NOTE: If you are testing whether mod_rewrite is enabled for your Mambo Open Source website, you need to follow these steps:

  • Rename your htaccess.txt to .htaccess, or use your existing .htaccess file.
  • Enable SEF URL's in your administrator backend
  • Place the following lines in your .htaccess file.
    Options +FollowSymLinks
      Redirect /google.html http://www.google.com
  • If your site is located in a sub-domain, eg. "test", you need to include the subdomain in the path, like this for example:
    Options +FollowSymLinks
      Redirect /test/google.html http://www.google.com
  • Point your browser to: http://www.example.com/google.html or http://www.example.com/subdomain/google.html (replacing example.com with the domain name of your own website and subdomain - if applicable- with your subdomain name).

If you are redirected to Google, mod_rewrite is working.
If you get an error, then mod_rewrite is not working.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Topic: Site Management
Tagged as: Apache, Google, htaccess file, Mambo, open source applications, search engine, web server

Share on FriendFeed

{ 0 comments… be the first to comment }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.