QQ客服热线
首页 > 信息资讯 > 技术专栏

技术专栏

在Godaddy主机配置.net 域名指向子目录,网址显示子目录的问题
2013年9月4日
摘要: 在Godaddy主机上,域名绑定到子目录,网址出现子目录名称的问题。

 

在Godaddy主机上,域名绑定到子目录,网址出现子目录名称的问题。

如:http://nbtcnet.com/news  实际你点击导航news,网址显示为:

http://nbtcnet.com/子目录名称/news 。 nopcommerce的网站程序安装到Godaddy主机,子目录都会出现类似的问题,那么如何解决呢。

其实很简单,只需要在web.config  <system.webServer>里配置下:

<rewrite>
<rules>
<rule name="Remove Virtual Directory">
<match url=".*" />
<action type="Rewrite" url="{R:0}" />
</rule>
</rules>
</rewrite>

就可以了。

这个方法来自国外的朋友,感谢他提供的方法:以下是他的原文:

I was struggling with this for quite a while. I found the following post over at goDaddy that allowed me to remove the subdirectory name from my url.
http://support.godaddy.com/library/removing-virtual-application-name-from-urls/

This issue may just be a godaddy issue because of the way their control panel sets up applications on subfolders I'm not sure. This solution may or may not work depending on your hosting environment and whether the rewrite module is installed on the server.

simply add the following to the <system.webServer> node in your web.config to give it a shot:

<rewrite>
<rules>
<rule name="Remove Virtual Directory">
<match url=".*" />
<action type="Rewrite" url="{R:0}" />
</rule>
</rules>
</rewrite>

 

来自TCNET 转载请保留www.nbtcnet.com

返回列表