• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

为啥APACHE设置了多站点,重写模块就失效了

php 搞代码 3年前 (2022-01-24) 31次浏览 已收录 0个评论

为什么APACHE设置了多站点,重写模块就失效了?
就改了两个文件
重启apache以后显示403Forbidden (这是预期的,因为根目录下没有index.php,真正的首页在其他文件夹里,通过重写url访问)

【httpd-vhosts.conf】

<br />#<br /># Virtual Hosts<br />#<br /># If you want to maintain multiple domains/hostnames on your<br /># machine you can setup VirtualHost containers for them. Most configurations<br /># use only name-based virtual hosts so the server doesn't need to worry about<br /># IP addresses. This is indicated by the asterisks in the directives below.<br />#<br /># Please see the documentation at <br /># <br /># for further details before you try to setup virtual hosts.<br />#<br /># You may use the command line option '-S' to verify your virtual host<br /># configuration.<br /><br />#<br /># Use name-based virtual hosting.<br />#<br />NameVirtualHost *:80<br /><br />#<br /># VirtualHost example:<br /># Almost any Apache directive may go into a VirtualHost container.<br /># The first VirtualHost section is used for all requests that do not<br /># match a ServerName or ServerAlias in any  block.<br />#<br /><br />    ServerAdmin [email protected]<br />    DocumentRoot E:\mcmod\www<br />    ServerName dummy-host.appservnetwork.com<br />    ServerAlias www.dummy-host.appservnetwork.com<br />    ErrorLog logs/dummy-host.appservnetwork.com-error_log<br />    CustomLog logs/dummy-host.appservnetwork.com-access_log common<br /><br /><br />NameVirtualHost *:90<br /><br /><br />    ServerAdmin [email protected]<br />    DocumentRoot E:\mcmod\video<br />    ServerName dummy-host2.appservnetwork.com<br />    ErrorLog logs/dummy-host2.appservnetwork.com-error_log<br />    CustomLog logs/dummy-host2.appservnetwork.com-access_log common<br />

——解决方案——————–

Options FollowSymLinks ExecCGI Indexes
AllowOverride None
Order deny,allow
Deny from all
Satisfy all

改为:

Options FollowSymLinks ExecCGI Indexes
本文来源[email protected]搞@^&代*@码)网9搞代gaodaima码AllowOverride None
Order allow,deny
Allow from all

——解决方案——————–
内容太多,又没重点,不细看了。估计没有大错
需要注意以下几点
重写是针对网站,所以每个网站都应有自己的重写规则
如果主网站没有停用的话,那么虚拟主机列表中的第一个,就等同于主站
此时主站也有 .htaccess 的话,可能造成路由中出现环或指向失败


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:为啥APACHE设置了多站点,重写模块就失效了
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址