上周有个需求要重定向几个exe文件,下载exe时跳转到合作商的下载页面去。
考虑使用apache的rewrite或redirect实现。
在.htaccess中用redirect /downloads/gns.exe
[url]http://www.domain.com/index.html[/url]……不行。
后来研究了一下rewrite。
经过多次尝试,最后的写法为:
在httpd.conf的虚拟主机字段中添加RewriteEngine .,
RewriteRule ^/downloads/gns.exe
[url]http://www.domain.com/index.html[/url]…… [R=301]
2009年1月19日
今天前辈又试了一下,他说不用rewrite也行的。
结果发现在.htaccess中用redirect /downloads/gns.exe
http://www.donain.com/index.html居然又可以了。
鸟不知道上次是怎么了。
转载于:https://blog.51cto.com/sharkyan/126270