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.