Apache隐藏index.php报错Internal Server Error

现在使用的是wampserver,配置了虚拟主机,按照ThinkPHP的手册中部署-URL重写的要求

  1. httpd.conf配置文件中加载了mod_rewrite.so模块
  2. AllowOverride None 将None改为 All
  3. 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下
<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>
其中,将httpd.conf中所有的 AllowOverride None都改成了AllowOverride All,重启Apache之后还是报错Internal Server Error。



原因在与include的httpd-vhosts.conf中配置没有改成允许URL重写。

只需将

<VirtualHost *:80>
    DocumentRoot "F:/wamp/www/test"
    ServerName www.test.com
ServerAlias admin.tpshop.com
    DirectoryIndex index.html index.htm index.php
    <Directory F:/wamp/www/test>
      Options FollowSymLinks
      AllowOverride none
      Order allow,deny
      Allow from all
    </Directory>
</VirtualHost>

改成


<VirtualHost *:80>
    DocumentRoot "F:/wamp/www/test"
    ServerName www.test.com
ServerAlias admin.tpshop.com
    DirectoryIndex index.html index.htm index.php
    <Directory F:/wamp/www/test>
      Options FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>
</VirtualHost>


然后保存,重启wampserver就可以了。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值