How to check and enable mod_rewrite module in apache

Advertisement

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/mod_rewrite.so” 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()”.

Popularity: 18% [?]

Enter your email address and get free tutorials, tips and tricks of PHP, Ajax, JavaScript and CSS directly delivered to you email inbox:

Related Posts

» Hide .php extension with url rewriting using .htaccess
» Get free ebooks of essential PHP and JavaScript tips , tricks & Hacks
» How did I reduce CPU overhead problem caused by MySql?
» How to know and handle disabled javascript in browser

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

  • salman Ahmad wrote on 15 April, 2008, 12:17

    THNX, I NEEDED THE STUFF.

  • Edmund wrote on 5 August, 2008, 3:55

    Thanks! It worked! :)

  • Manish wrote on 25 September, 2008, 10:25

    Thank you

  • !DSeva wrote on 25 September, 2008, 19:51

    Simply Thanks.

  • Divya wrote on 23 November, 2008, 6:50

    Hi,
    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??

  • thezainic wrote on 18 February, 2009, 9:05

    i need php script for checking mod_rewrite. thx

  • mgyaykhae wrote on 8 April, 2009, 16:35

    Many Thanks.

  • G000085 wrote on 17 April, 2009, 1:23

    Really thank you it worked :)

  • Elemental Web and Mobile Solutions wrote on 23 June, 2009, 8:37

    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”

  • vishuna wrote on 16 July, 2009, 13:46

    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
    vishuna

  • Tapas Mandal wrote on 24 July, 2009, 8:21

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

  • saritha wrote on 31 August, 2009, 18:26

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

  • James Radford wrote on 1 September, 2009, 9:47

    Thanks for this article.
    Good stuff.

  • Arivusudar wrote on 12 October, 2009, 9:38

    Thanks very much.. Its working nice

  • james wrote on 2 November, 2009, 9:17

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

  • Gerardo Alvarez wrote on 20 November, 2009, 23:50

    Great thanks a lot

  • amitmj wrote on 9 January, 2010, 6:44

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

  • Rajeshkumar wrote on 23 January, 2010, 12:05

    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

  • Ajith wrote on 27 January, 2010, 11:08

    thanks lot

  • Shree wrote on 5 February, 2010, 7:09

    Hi
    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.
    Regards,
    Shree

  • Bipin wrote on 4 March, 2010, 11:43

    excellent
    thanks a lot

  • Kapil Dhiman wrote on 2 April, 2010, 6:23

    Dear Thanks alot realy….

  • Bhalodi wrote on 12 April, 2010, 14:03

    Hi,
    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.
    thanks
    dvs

  • Sahil wrote on 11 May, 2010, 7:34

    Good it really simple and very helpful

  • Tapa wrote on 11 May, 2010, 13:57

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

  • MrWhippy wrote on 11 June, 2010, 1:16

    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.

  • john wrote on 23 June, 2010, 22:00

    It has a useful post. Thanks

  • davet wrote on 15 July, 2010, 15:03

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

    Thanks!

  • mohan wrote on 16 August, 2010, 11:21

    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

  • user wrote on 30 August, 2010, 11:39

    great post

  • Nilesh Tighare wrote on 3 September, 2010, 13:00

    Thanks for providing such useful information in a simple way.

  • Shabnam wrote on 6 September, 2010, 5:43

    Thank you very much…..It’s working

  • Madhan wrote on 6 September, 2010, 16:27

    Thanks a lot :)

  • Kavita wrote on 8 September, 2010, 11:52

    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 http://www.sfihomebizz.com/go/godaddy.php but I want that by just clicking the url http://www.sfihomebizz.com/go/godaddy a user is redirected to my godaddy referral url. What code should I add in .htaccess for this to happen.

  • matt wrote on 7 December, 2010, 3:30

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

  • arvind wrote on 21 January, 2011, 11:02

    how to edit urls…

  • arvind wrote on 21 January, 2011, 11:05

    i m working on this website http://www.googlecricket.com..nd i need ur help.in working with php files

  • Vinay` wrote on 19 February, 2011, 17:00

    Thanks I am starting and this has definitely helped me.

  • Facebook Like wrote on 28 February, 2011, 9:48

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

  • ??? wrote on 23 March, 2011, 12:49

    thank you very mush for this info

  • Dharamvir wrote on 16 June, 2011, 12:25

    Thanks for this cool trick.

  • Sultan Shaker wrote on 12 December, 2012, 18:27

    Thanks a lot for help and share knowledge with us …

Trackbacks

  1. AJAX coding school » Blog Archive » AJAX Examples [2008-04-07 07:46:31]
  2. Hide .php extension with url rewriting using .htaccess
  3. Hide .php extension with url rewriting using .htaccess - Huy’s Blog
  4. Snygga permalänkar i Wordpress
  5. URL Rewriting using .htaccess in PHP | php genious
  6. Hide .php extension with url rewriting using .htaccess « Santanu Bera

Write a Comment

 


Copyright © 2014 Roshan Bhattarai's Blog. All rights reserved.
Powered by WordPress.org, Custom Theme and ComFi.com Calling Card Company.