本帖最后由 游龙 于 2018-6-1 15:47 编辑
修改apache配置文件去除thinkphp url中的index.php 例如你的原路径是 http://localhost/test/index.php/index/add 变成 http://localhost/test/index/add
如何去掉index.php呢? 1、httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉
2、AllowOverride None 将None改为 All Options None 改为 Options All 注意:在APACHE里面去配置 (注意其他地方的AllowOverride也统统设置为ALL)
<Directory "/wampp/apache/cgi-bin"> AllowOverride none 改 AllowOverride ALL Options None 改 Options All Order allow,deny Allow from all </Directory> <Directory "cgi-bin"> #AllowOverride None #Options None AllowOverride all Options all Order allow,deny Allow from all </Directory> ------------------------------------ 配置了别名的例子: Alias /wnwweb "/wamp/www/wnwweb/" <Directory "/wamp/www/wnwweb/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Deny,Allow Deny from all </Directory>
3 、.htaccess文件必须放到跟目录下 代码如下: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
|