How to enable mod_rewrite in Apache

To enable the rewrite module in Apache you will need access to the httpd.conf file, located in {Apache folder}/conf/httpd.conf
Open up the file, and search for
#LoadModule rewrite_module modules/
and simply remove the # from the start of the line. Then save the file, and restart the Apache server. You should now be able to use the mod_rewrite functionality on your server. to test this, create a new file called test.php in your root html folder, with the following code in it

and put

RewriteEngine On
RewriteBase /
RewriteRule ^test/(.+)$ test.php?p=$1 [L]

into a .htaccess file in the same folder

Don’t forget to delete these two files after testing

Tags: , ,

Leave a Reply

You must be logged in to post a comment.