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被使用。