Original address: http://www.thinkphp.cn/topic/30538.html
For example, your original path is http://localhost/test/index.php/index/add.
So now the address is http://localhost/test/index/add.
How to get rid of index.php?
The mod_rewrite.so module is loaded in the 1.httpd.conf configuration file//configured in Apache
- #LoadModule rewrite_module modules/mod_rewrite.so To remove the siren from the front.
Copy Code
2.AllowOverride None speak none change to all//in Apache to configure
- <directory "D:/server/apache/cgi-bin">
- allowoverride None Change allowoverride all
- Options None
- Order Allow,deny
- Allow from all
- </Directory>
Copy Code
3. Make sure the Url_model is set to 2,
Write in the project's configuration file
- return Array(
- ' Url_model ' = ' 2 ',
- );
Copy Code
4. htaccess files must be placed in the directory with
This file adds:
- <ifmodule mod_rewrite. C>
- Rewriteengine on
- Rewritecond%{request_filename}!-d
- Rewritecond%{request_filename}!-f
- Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
- </IfModule>
Copy Code
Add: You can't create a file with a dot at the beginning of windows, you can just create a file
Then in DOS in Operation Rename Xxxx.xxxx. htaccess
or open Notepad to write htaccess and save As. htaccess
If a 403 error occurs, the. htaccess opens at the beginning to add options +followsymlinks
That
- Options +followsymlinks
- <ifmodule mod_rewrite. C>
- Rewriteengine on
- Rewritecond %{request_filename}- d
- Rewritecond %{request_filename}- f
- Rewriterule ^ (. *)$ index. PHP/$ [QSA,PT,L]
- </ifmodule>
Copy Code
can be resolved.
No permissions also add options +followsymlinks
Remove index.php from thinkphp