為啥APACHE設定了多網站,重寫模組就失效了

來源:互聯網
上載者:User
為什麼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 的話,可能造成路由中出現環或指向失敗
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.