1、打开apache安装目录中的httpd.confg,修改以下内容:
开启以下扩展:LoadModule rewrite_module modules/mod_rewrite.so
在Directory标签中,将AllowOverride none 设置为AllowOverride All
2、thinkphp6框架public文件夹.htaccess,将.htacess内容修改为以下内容:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
3、如果你是使用WAMP搭建的环境,那么不需要修改.htacess,而是需要httpd-vhost.conf文件中修改规则,如下所示。
<VirtualHost *:80>
# 你的ThinkPHP项目里的public文件夹
DocumentRoot "D:\wamp64\www\HTCMS\public"
# 你的域名
#ServerName tp601.cy
<Directory "D:\wamp64\www\HTCMS\public">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
|