Thinkphp 配置不用輸入index.php


版權聲明:本文為博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。
本文鏈接: https://blog.csdn.net/u011186019/article/details/78495461

由:http://127.0.0.1/thinkphp/index.php/index/index

改成:http://127.0.0.1/thinkphp/index/index

Apache服務器

 1、在http.conf配置文件中加載mod_rewrite模塊

1 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警號去掉

 

 2、在配置文件中

 1  <Directory "c:/wamp/bin/apache/apache2.4.9/cgi-bin">
 2  
 3 AllowOverride ALL # 原來的是None
 4  
 5 Options None
 6  
 7 Order allow,deny
 8  
 9 Allow from all
10  
11 </Directory>

 

3、在根目錄增加文件.htaccess文件(注意windown無法創建(.)開頭的文件,解決辦法自行百度) 

 1 <IfModule mod_rewrite.c>
 2  
 3 Options +FollowSymlinks
 4  
 5 RewriteEngine On
 6  
 7  
 8  
 9 RewriteCond %{REQUEST_FILENAME} !-d
10  
11 RewriteCond %{REQUEST_FILENAME} !-f
12  
13 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
14  
15 </IfModule>
4、重啟服務器即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM