為什麼APACHE設定了多網站,重寫模組就失效了?
就改了兩個檔案
重啟apache以後顯示403Forbidden (這是預期的,因為根目錄下沒有index.php,真正的首頁在其他檔案夾裡,通過重寫url訪問)
【httpd-vhosts.conf】
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#
ServerAdmin [email protected]
DocumentRoot E:\mcmod\www
ServerName dummy-host.appservnetwork.com
ServerAlias www.dummy-host.appservnetwork.com
ErrorLog logs/dummy-host.appservnetwork.com-error_log
CustomLog logs/dummy-host.appservnetwork.com-access_log common
NameVirtualHost *:90
ServerAdmin [email protected]
DocumentRoot E:\mcmod\video
ServerName dummy-host2.appservnetwork.com
ErrorLog logs/dummy-host2.appservnetwork.com-error_log
CustomLog logs/dummy-host2.appservnetwork.com-access_log common
------解決方案--------------------
Options FollowSymLinks ExecCGI Indexes
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
改為:
Options FollowSymLinks ExecCGI Indexes
AllowOverride None
Order allow,deny
Allow from all
------解決方案--------------------
內容太多,又沒重點,不細看了。估計沒有大錯
需要注意以下幾點
重寫是針對網站,所以每個網站都應有自己的重寫規則
如果主網站沒有停用的話,那麼虛擬機器主機列表中的第一個,就等同於主站
此時主站也有 .htaccess 的話,可能造成路由中出現環或指向失敗