apache

Testing mod_rewrite with an .htaccess file

After enabling mod_rewrite and configuring a directory to AllowOverride All in the /etc/httpd/conf/httpd.conf file, you can use the steps below to test that it is enabled and working properly.

Create an .htaccess file and give it the following content

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html http://www.google.com/? [R=301,L]

Now, when you visit /test.html you will be redirected to http://www.google.com. The snippet above assumes the .htaccess file resides in the document root.

more Apache posts