如何重定向 URL
How to redirect URL
如何重定向 url
来自
www.example.com/file.html
到
www.example.com/folder/file.html
使用 .htaccess
和 web.config
我搜索了几个小时,找到了几个主题,但 none 适合我们
对于 IIS:
在旧页面所在的目录中打开web.config。然后在 web.config
中为旧位置路径和新目的地添加代码,如下所示:
<configuration>
<location path="file.html">
<system.webServer>
<httpRedirect enabled="true" destination="www.example.com/folder/file.html" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
对于阿帕奇:
在 .htaccess
中添加以下行:
Redirect /file.html http://example.com/folder/file.html
如何重定向 url 来自
www.example.com/file.html
到
www.example.com/folder/file.html
使用 .htaccess
和 web.config
我搜索了几个小时,找到了几个主题,但 none 适合我们
对于 IIS:
在旧页面所在的目录中打开web.config。然后在 web.config
中为旧位置路径和新目的地添加代码,如下所示:
<configuration>
<location path="file.html">
<system.webServer>
<httpRedirect enabled="true" destination="www.example.com/folder/file.html" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
对于阿帕奇:
在 .htaccess
中添加以下行:
Redirect /file.html http://example.com/folder/file.html