配置完apache虚拟主机能访问到目录下php文件,可是访问Think的index.php报错?

<VirtualHost *:80>

 DocumentRoot "D:\php\ThinkPHP\TP5.0\public"
 ServerName www.chenhao.com
 <Directory "D:\php\ThinkPHP\TP5.0\public">
    Options FollowSymLinks  
    AllowOverride None  
    Order deny,allow
    #Require all granted        
    Allow from all        
</Directory>

</VirtualHost>

配置完之后能访问a.php可是访问index.php错误

阅读 2.4k
评论
    3 个回答

    需要在与index.php 同目录下添加.htaccess文件

    .htaccess 文件内容

    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php/$1 [L]

    记得要开启apache的重写,否则不生效

      相似问题
      推荐文章