Page 1 of 1

Test if the Apache Mod_Rewrite module is enabled

Posted: Thu Feb 15, 2018 9:42 pm
by steven
To determine if Mod_Rewrites are enabled, you can add the RewriteRule below to your existing htaccess file immediately after RewriteEngine On or you can create another htaccess file with the code below. (Be sure to rename your old htaccess file first)

Code: Select all

RewriteEngine On
RewriteRule ^.*$ test_mod_rewrite.php
Second create a file named test_mod_rewrite.php in the same folder as the .htaccess file, you just created, and place the following code in the file:

Code: Select all

<?php echo "Apache Mod_rewrite is enabled!"; ?>
Enter your URL and if you see the Mod_rewrite message, rewrites are enabled. Don't forget to comment out the RewriteRule or change back to your original htaccess file after the test.

You can download the test files below but don't overwrite your original htaccess file.

test_mod_rewrite.zip
(806 Bytes) Downloaded 1244 times


Note: the download version of test_mod_rewrite.php has additional inline CSS formatting to look a little fancier but has been W3C verified.