• Home
  • About

szehau's weblog

Life, Internet, Software, Gadgets, Programming and Investments

  • life log
  • internet
  • programming
  • software
  • working holiday
  • gadget
  • project

Enable .htaccess and url rewriting in Apache for Windows

July 23, 2006 22:14 by Sze Hau 19 Comments

When I try to setup PHP and Apache in my notebook, I try to enable the .htaccess setting in apache’s httpd.conf. After I tried for a few hours (YES, a few hours) at my notebook and google-ing on the internet, finally I found the complete solution.

I record the steps here so that it can help those who want to enable .htaccess and url rewriting in Apache for Windows and also for my own reference in future.

1. Make sure you have setup apache and php correctly. Make sure that you can run php scripts without any problem.

2. Use notepad to open httpd.conf config file. Make use the line “LoadModule rewrite_module modules/mod_rewrite.so” is un-commented.

3. Under “<directory XXX></directory>” section, change the line “AllowOverride None” to “AllowOverride All“.

4. Change the line “AccessFileName .htaccess” to “AccessFileName htaccess“. This is because in Windows, we can’t have a file with filename that starts with a dot.

5. Save the changed file and restart Apache Windows Service. You can then use the file htaccess to process your url rewritting.

More from my site

  • PIKOM PC Fair 2009 (II)PIKOM PC Fair 2009 (II)
  • Snow Wolf Lake VideoSnow Wolf Lake Video
  • Jogging at Pandan Indah Town ParkJogging at Pandan Indah Town Park
  • What Are Programmers Doing In The Weekend?What Are Programmers Doing In The Weekend?
  • New Tick Sizes for Securities Traded on Bursa MalaysiaNew Tick Sizes for Securities Traded on Bursa Malaysia
  • The Movie – 2012The Movie – 2012

Filed Under: programming

About Sze Hau

Geek. Love programming. Coffee addicted. Married with a child. Working towards financial freedom.

Comments

  1. mypapit says

    July 24, 2006 01:27 at 1:27 am

    nice howto, bookmarked :)

    Reply
  2. Nemanja says

    September 1, 2006 06:23 at 6:23 am

    Bravo! Worked like a charm. Thanks.

    Reply
  3. SubZane says

    November 10, 2006 22:46 at 10:46 pm

    Thank you for saving me those countless hours :)

    Reply
  4. Ryan says

    November 26, 2006 07:53 at 7:53 am

    Brilliant! Thank you!!

    Reply
  5. Anoop Kumar says

    August 2, 2007 19:50 at 7:50 pm

    Thanks to szehau….
    :)

    Reply
  6. winxp says

    April 9, 2008 23:56 at 11:56 pm

    you can create “.htaccess” file by using notepad(save as .htaccess file) in windows :)

    Reply
  7. Kailash Kumar P says

    April 16, 2008 15:51 at 3:51 pm

    Thank you very much.
    the solution what u have given above is amazing.

    Reply
  8. Vuong Ho says

    April 26, 2008 15:43 at 3:43 pm

    I try to follow steps that you showed on my laptop but it doesn’t work at all. You mentioned about
    4. Change the line “AccessFileName .htaccess” to “AccessFileName htaccess”.

    I am using wamp and don’t see anywhere in the httpd.conf file have that statement. Where should I put it in the httpd.conf?

    Thanks for your help

    Reply
  9. szehau says

    April 27, 2008 10:55 at 10:55 am

    Hi Vuong Ho, you can try put the line to the end of the httpd.conf file or any place in the httpd.conf file (but not between and tage).

    Reply
  10. Developer says

    September 20, 2008 17:31 at 5:31 pm

    Hi,

    I couldnt find httpd.conf file in my server…can u help me can we write manually httpd.conf file…

    Thanks
    Developer

    Reply
  11. szehau says

    September 20, 2008 18:06 at 6:06 pm

    Hi, you get a sample configuration from apache.. just download the full package from apache and use the httpd.conf in the package.

    Reply
  12. Sarwar Zahan says

    October 17, 2008 14:43 at 2:43 pm

    The solution is given is amazing and solved my problem after a lot of search in the internet.Thanks

    Reply
  13. szehau says

    October 19, 2008 06:02 at 6:02 am

    Hi Sarwar Zahan, you are welcome.

    Reply
  14. Karl says

    January 15, 2009 04:19 at 4:19 am

    Worked for me too…

    Reply
  15. Andrei says

    May 26, 2009 17:19 at 5:19 pm

    Brilliant solution, but in order for the thing to work 100% you need to add

    Order allow,deny
    Deny from all
    Satisfy All

    into httpd.conf file.
    and change names of all the “.htaccess” to “htaccess” in all the directories on the website.

    thank you for pointing me out to right direction.

    Reply
    • szehau says

      May 27, 2009 22:16 at 10:16 pm

      Thank you too, Andrei.

      Reply
  16. Donald says

    May 7, 2010 19:49 at 7:49 pm

    Thanks!!!

    Reply
  17. Prabhakar Kasi says

    June 18, 2010 16:10 at 4:10 pm

    Hello. Thanks for documenting the steps. I read same solution in different websites but luckily things worked after reading you website. LUCKY!!!

    Thanks.

    Reply

Trackbacks

  1. Running Apache on Windows « Web Dev Blog says:
    May 5, 2009 15:58 at 3:58 pm

    […] source: http://www.szehau.com/archives/2006/07/enable-htaccess-and-url-rewriting-in-apache-for-windows/ […]

    Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Email News Letter

Sign up to receive updates daily and to hear what's going on with us

  • Facebook
  • Google+
  • Instagram
  • Twitter

More Posts

5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic

June 1, 2021 22:15 By Sze Hau Leave a Comment

LED Downlight

Troubleshooting A Flickering LED Downlight

February 13, 2016 00:29 By Sze Hau Leave a Comment

Repair A Broken iPhone Lightning Cable

January 30, 2016 00:54 By Sze Hau Leave a Comment

Sponsored Links

Blog Network

  • Personal Fincance Personal Finance – Personal Money Tips, Stock Investment, Small Business and Make Money Online
  • Snippet IT Information technology news, ideas and experiences and opinions

szehau’s weblog

szehau is a software programmer that has strong interest in the world of programming and Internet. He is graduated in University of Malaya, Malaysia with a Bachelor’s degree in Software Engineering. He draws on his passsion for web programming to share with others how to build a successful websites.

Recent

  • 5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic
  • Troubleshooting A Flickering LED Downlight
  • Repair A Broken iPhone Lightning Cable
  • New Gadget – MacBook Pro with Retina Display (2015)
  • One Watt LED Night Light

Search

Tags

adsense advertisement baby blog blogtal Canon EOS 400D Chinese New Year Christchurch CNY DiGi electronic Facebook FBM Flickr Flickr Uploadr Google Google Maps Google Search Results Google Webmaster Central H1N1 income tax investment joke KLCI KLSE Lake Tekapo Maxis Maybank2u Motueka movie mutual funds New Zealand PC Fair 2009 Queenstown restaurant for dinner sharing stock trackback travel Twitter unit trust visa wordpress wordpress plugin working holiday

Copyright © 2025 · Magazine Pro Theme on Genesis Framework · WordPress · Log in