我编写了一个简单的python脚本,用于在单击广告后重定向url。
与广告关联的url是http://server.example.com/redirect.py
。在
redirect.py
的代码如下所示:
import cgi
import cgitb
cgitb.enable()
print('Content-Type: text/html\n\n')
print('Location: http://www.finalurl.com')
但是,当点击广告时,不是将请求重定向到www.finalurl.com
,而是简单地在浏览器窗口中显示最终的url。非常感谢所有的帮助。在
请注意,redirect.py
脚本位于/public_html/cgi-bin/
文件夹中,并且该脚本具有711
权限。另外,目标url并不总是相同的url,它是基于数据库查询的。那个代码被简单地省略了。在
我还尝试了包括:print ("Status: 301 Moved")
“\n\n”是http头标记的结尾,请改用:
相关问题 更多 >
编程相关推荐