How to check and enable mod_rewrite module in apache

Well, I’ve got around 15 emails asking from readers, how to check the mod_rewrite module in apache and enable mod_rewrite module in apache after reading two most of the popular post of this blog 5 useful url rewriting examples and hide .php extension with url rewriting.

How to check weather mod_rewrite module is enabled or not?

Well there are lots of technique to check this but I’ll show you a very simple technique to check weather mod_rewrite module is enabled or not in you web server.

1) Type <?php phpinfo(); ?> in a php file and save it and run that file in the server.
2) And now you can the list of information, just search the word “mod_rewrite” from the browser’s search menu
3) If it is found under the “Loaded Modules” section then this module is already loaded as you see in the picture below, otherwise you need to go to the next step for enabling mod_rewrite module.

check mod rewrite module

How to enable mod_rewrite module in apache in xampp, wamp?

Now, I’ll show you how to enable how to mod_rewrite module in apache installed under windows environment.
1) Find the “httpd.conf” file under the “conf” folder inside the Apache’s installation folder.
2) Find the following line “#LoadModule rewrite_module modules/” in the “httpd.conf” file.You can do this easily by searching the keyword “mod_rewrite” from find menu.
3) Remove the “#” at the starting of the line, “#” represents that line is commented.
4) Now restart the apache server.
5) You can see now “mod_rewrite” in the Loaded Module section while doing “phpinfo()”.

48 thoughts on “How to check and enable mod_rewrite module in apache

  1. salman Ahmad


  2. Edmund

    Thanks! It worked! :)

  3. Manish

    Thank you

  4. Simply Thanks.

  5. Divya

    For security reasons I have to hide the actual names of all the html pages kept in a directory named crop under documentroot directory. I have enabled mod_rewrite module but don’t know how to actually change the url path. please help me out.

    the actual url is http://localhost/crop/*.html
    * are numerous webpages
    how to change these??

  6. thezainic

    i need php script for checking mod_rewrite. thx

  7. mgyaykhae

    Many Thanks.

  8. G000085

    Really thank you it worked :)

  9. Thanks very much, however there are other things you can do as well to specify the document root, as some people might have a problem with getting their php applications to work with a specific directory.

    changing the parameter in your httpd.conf will help: DocumentRoot: “/var/www/html”

  10. i am really new to apache can you tell me how to do a forwarder on one apache server (server1 primary) to server2 Secondary server.
    and can you tell me how to enable .cgi
    as i say i am really new to this so the more detail the better for me
    thanks for your help

  11. Tapas Mandal

    i am new in .htaccess, want to know the procedure how to write and execute htaccess file.
    i use xamp server in pc.

  12. Thank you so much….it helped me a lot !!!

  13. Thanks for this article.
    Good stuff.

  14. Arivusudar

    Thanks very much.. Its working nice

  15. This is really a great tutorial for mod rewrite. Thanks :)

  16. Great thanks a lot

  17. explained very simply just like that thanks bro i have searching for this information 2 days now. good job!!!!!!!!!!!

  18. Rajeshkumar

    Hi I have tried for rewriting url as in the htaccess file Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^ex.html$ example.php. I have created example.php page, when i type in the address bar localhost/directoryname/ex.html, i want to get example.php page but its not working. Please help me… and also i have tried as you have explained above.. Please help me Thanks&Regards Rajeshkumar

  19. Ajith

    thanks lot

  20. Shree

    Thanks for the useful information. But I have one question.
    First of all I don’t have access for “httpd.conf” so How do I enable “mod_rewrite” module?

    please help me.

  21. Bipin

    thanks a lot

  22. Kapil Dhiman

    Dear Thanks alot realy….

  23. Bhalodi

    i try to run .htaccess but error is display page is not found.
    i have change above and also show mod_rewrite in module loaded box in phpinfo().
    but its not working in local pc.
    Please help me.

  24. Sahil

    Good it really simple and very helpful

  25. Tapa

    Thank-you so much for explaining it in so simple but clear steps.

  26. MrWhippy

    This is the ONLY decent primer on the basics on enabling mod_rewrite on the web. I know because I have spent half a day looking. Well done.

  27. It has a useful post. Thanks

  28. Thats great , if only everyone could just tell me what I need to do in plain english


  29. AuthType Basic
    AuthName “http://localhost/domain/adminpanel”
    AuthUserFile http://localhost/domain/adminpanel/.htpasswd
    Require valid-user
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^/]+).html?$ $1.php [L]

    i am using this code but i am not get output (php to html extension)

    please help me anybody

  30. user

    great post

  31. Nilesh Tighare

    Thanks for providing such useful information in a simple way.

  32. Shabnam

    Thank you very much…..It’s working

  33. Madhan

    Thanks a lot :)

  34. Thanks for the information but did not help me in hiding php extension of my affiliate redirect php urls. For example my affiliate redirect url for godaddy is but I want that by just clicking the url a user is redirected to my godaddy referral url. What code should I add in .htaccess for this to happen.

  35. Mate! This great tutorial fixed my problem instantly..Thanks…….Matt

  36. how to edit urls…

  37. i m working on this website i need ur working with php files

  38. Thanks I am starting and this has definitely helped me.

  39. Information for this blog is very nice thanks for sharing this information keep it up

  40. ???

    thank you very mush for this info

  41. Thanks for this cool trick.

  42. Sultan Shaker

    Thanks a lot for help and share knowledge with us …

Leave a Reply

Your email address will not be published. Required fields are marked *