我在www.mysite.com名的网站。 当网址是www.mysite.com,我想打电话给index1.php文件(这是我的主域名)。
如果URL是从像test1.mysite.com,test2.mysite.com子域的话,我想打电话给index2.php文件。
怎么办呢htaccess的? 任何帮助是极大的赞赏..
提前致谢。!
我在www.mysite.com名的网站。 当网址是www.mysite.com,我想打电话给index1.php文件(这是我的主域名)。
如果URL是从像test1.mysite.com,test2.mysite.com子域的话,我想打电话给index2.php文件。
怎么办呢htaccess的? 任何帮助是极大的赞赏..
提前致谢。!
如果他们都在同一个文档根目录,把像这样在文档根目录的htaccess文件:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteRule ^$ /index1.php [L]
RewriteCond %{HTTP_HOST} !^(www\.)?mysite\.com$ [NC]
RewriteRule ^$ /index2.php [L]
如果您有需要重写链接的目录索引,你可以做那些对案件逐案的基础,例如:
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteRule ^(.*)/index\.(php|html|htm)$ /$1/index1.php [L]
RewriteCond %{HTTP_HOST} !^(www\.)?mysite\.com$ [NC]
RewriteRule ^(.*)/index\.(php|html|htm)$ /$1/index2.php [L]