我必须为mysite编写htaccess。实际上我们有两个域。'.com和.in‘。例如,我打开了'.com‘站点,它将自动访问'.in’域中的文件。.com站点中没有文件。如何为此编写.htaccess。
谢谢。
发布于 2011-01-13 17:21:42
如果您有访问web服务器的权限,请使用配置来确定。在使用apache2的情况下,它只需要虚拟主机中的服务器别名。否则,使用重定向或url重写。
如果您也无法使用它们(因为您在有限的虚拟环境中,f.e.),请在.com目录中放置一个index.html,将其配置为通过meta-refresh标记进行重定向。将以下行放在index.html的标题部分:
<meta http-equiv="refresh" content="0; URL=http://yourinsite.in/">然后在.htaccess文件上使用DirectoryIndex指令自动将其加载为默认索引页:
DirectoryIndex index.html
这会在用户浏览yoursite.com/时调出index.html,并自动将她引导到yourinsite.in。
发布于 2011-01-13 17:43:59
您是否有权访问服务器配置?从您上面的评论判断,您实际想要的是设置一个server alias,其中.com和.in站点是相同的?这将使.com站点加载.in,反之亦然。
发布于 2011-01-13 20:58:31
另一个你可以使用的解决方案,如果你没有服务器访问它使用一个域框架斗篷,这将保持在地址栏中的.com网址,但加载的.in网站在一个框架内,把这段代码在index.html上的.com网站,填写玩具需要。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>TITLE OF THE SITE</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Description" content="Description of the site"
</head>
<frameset rows="100%,*">
<frame frameborder="0" src="http://domain.in" scrolling="auto">
<noframes>
<body>
<p><b>Welcome on our site. Your browser do not support frames.</b></p>
<p><a href="http://domain.in">Click here to go to the page.</a></p>
</body>
</noframes>
</frameset>
</html>https://stackoverflow.com/questions/4678332
复制相似问题