How To: Test mod_rewrite

3:07 pm on March 26th, 2011 | SysAdmin, Tech

This is more of a self-note to myself. This simple test will confirm if that mod_rewrite apache module you just enabled is actually working. Once you have enabled the mod_rewrite module using “a2enmod mod_rewrite”, create a .htaccess file in the document root with the following content:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.google.com/$1 [R=301,L]

Restart apache and go to that site of yours. You should be redirected to Google.com automagically. If not check your file permissions.

Leave a Reply