phpstudy部署thinkPHP

时间:2023-03-10 08:42:28
phpstudy部署thinkPHP

利用phpstudy配置虚拟主机

Listen 8080
<VirtualHost _default_:80>
DocumentRoot "D:\phpStudy\WWW"
<Directory "D:\phpStudy\WWW">
Options -Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:8080>
DocumentRoot "D:\GitHub\TPVueTODO\public"
ServerName www.todo.com
ServerAlias todo.com
<Directory "D:\GitHub\TPVueTODO\public">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>

注意是public目录

url 重写

但入口文件访问时url总需要带上index.php,实际使用中可以使用apace的url重写模块完成自动加入index.php。这个需要public下面的.htaccess文件。如果碰到No input file specified.可能需要修改下这个文件:

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

在默认情况下会导致No input file specified. 修改成:

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]