利用phpstudy配置虚拟主机
Listen 8080
<VirtualHost _default_:80>
DocumentRoot "D:phpStudyWWW"
<Directory "D:phpStudyWWW">
Options -Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "D:GitHubTPVueTODOpublic"
ServerName www.todo.com
ServerAlias todo.com
<Directory "D:GitHubTPVueTODOpublic">
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]