0
我想爲主域名的一個頁面創建子域名。我不想有文件的副本,所以我嘗試使用mod_rewrite來解決它。.htaccess讓子域名行爲爲主域名
只要當我去submdomain.domain.com我想顯示頁面xyz.html作爲index.html與所有圖片。國防部重寫應在瀏覽器的URL地址保持作爲subdomain.domain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteCond %{REQUEST_URI} !(index.html)
RewriteRule ^(.*) http://www.domain.com/$1 [P,L]
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteCond %{REQUEST_URI} index.html
RewriteRule index.html http://www.domain.com/xyz.html [P,L]
這個的.htaccess被保存在根目錄下的子域。不幸的是,它只能分開工作。上半場只在下半場失蹤時纔有效,反之亦然。所以我可以做重定向,只顯示xyz.html頁面作爲索引頁面,但沒有圖像,或者做所有子域文件的重定向,但是xyz.html被忽略,主域名index.html被使用。