Arvixe主机其提供Linux和Windows两种系统的主机,尤以Windows操作系统主机出名,当我们使用Arvixe主机搭建网站,安装源程序后,会遇到内页URL地址冗余的情况,下面和大家说说如何重写ASP空间的URL地址。
例如:没有重写时URL地址为:http://yourdomain.com/index.php/pages/1.html
URL重写后地址为:http://yourdomain.com/pages/1.html
那么为了达到这个目的,需要修改web.config文件内容。
修改后Web.config文件配置如下代码所示:
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<directoryBrowse enabled=”false” />
<defaultDocument>
<files>
<clear />
<add value=”index.php” />
<add value=”default.php” />
<add value=”default.html” />
<add value=”index.html” />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name=”index.php” >
<match url=”^(.*)$” ignoreCase=”true” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”^(.*)$” />
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php/{R:1}” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
如果操作过程有错误,请详细检查代码是否有错,或者移步美国主机侦探论坛相关版块发帖求助。