turn from: http://www.cnblogs.com/banruo/archive/2010/11/02/1867536.htmlBecause I was configured with Wampserver, using the thinkphp framework, found no transport. htaccess, very bad use Ah, and then I use the first step to restart Apache success, is to search/mod_rewrite.so. Remove the front # number. The truth is needless to say, a look will understand. In order to be able to encounter this problem, first reprint it
today, I saw a friend of the post sent a rewrite post, previously also wrote a, configuration is quite simple, but did not pay attention to this problem, at that time did not use. htaccess file, tested on the machine, found that it is really useless, and began to find the problem.
I built it from scratch:
1. First determine the Apache version you are using, and whether the Mod_rewrite module is loaded.
Simple method Echo phpinfo (); See if there's any rewrite in Apache's mod.
If you have skipped this step
Users of Apache 1.x please check the conf/httpd.conf for the following two pieces of code:
LoadModule Rewrite_module libexec/mod_rewrite.so
Addmodule mod_rewrite.c
Apache 2.x users check to see if the following code exists in the conf/httpd.conf:
LoadModule Rewrite_module modules/mod_rewrite.so
Note: If there is a # before, remove it. And make sure you have mod_rewrite.so files in your Apache file (1.X version of mod_rewrite.c).
2. Configure Apache configuration file httpd.conf implementation rewrite
Found it
< Ifmodule mod_rewrite. C >
</ifmodule >
Do not add yourself, then write your Rewrite rules between, for example: < Ifmodule mod_rewrite. C >
Rewriteengine on
Rewriterule ^ Test. htm$ test. Php
</ifmodule >
3. Please be sure to note that if the site used through the virtual host to define, please be sure to add to the virtual host configuration, that is, <VirtualHost>, if added to the virtual host configuration will not be able to use, restart Apache,rewrite configuration is over.
4. Let Apache support. htaccess
Remove the code from the <ifmodule mod_rewrite.c>.
Found it
< Directory/>
Options FollowSymLinks
AllowOverride None
</Directory >
Change the inside allowoverride to Allow Override all so that the. htaccess file can be enabled.
5. Create a. htaccess file, win can be built with a notepad++ editor (Notepad not), if it's too troublesome this document is included in the attachment, placed in the project directory, and then write their own rules inside.
Rewriteengine on
Rewriterule ^ Test. htm$ test. Php
6. Restart Apache, okay?
7. General Apache above configuration on the line, but my not yet, so the study of Apache configuration file found such a parameter:
Accessfilename access. Ht
it means; Accessfilename defines the file name of the access control file under each directory, and the default is. htaccess (most people are just. htaccess, so a lot of online tutorials don't write this step, and mine is access.ht), you can change this file, To change access control restrictions for different directories.
Changed it to
Accessfilename. Htaccess
8. Restart Apache on the line.
Outside the question:. htaccess location Problem: The htaccess file (or distributed configuration file) provides a way to change the configuration for each directory by placing a file containing instructions in a specific directory, with instructions for this directory and all its subdirectories. (You can have a. htaccess file under each folder)