内部链接损坏问题

发布于 2024-11-15 12:23:17 字数 1100 浏览 3 评论 0原文

我不断收到 django 发来的关于内部链接损坏的电子邮件,我无法解释:

Referrer: http://www.emetor.com/forum/
Requested URL: /thanks/forum/
User agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
IP address: xxx.xxx.xxx.xxx

它们似乎是由于推荐人页面上的联系表单造成的,成功提交后会重定向到 http://www.emetor.com/thanks/。当我尝试联系提交时,一切正常。但我担心我可能会错过一些联系提交!

有人可以解释一下问题可能出在哪里吗?如果您需要更多信息,请告诉我...


联系表单执行以下操作:

<form action="/contact/" method="post">

在联系视图中:

def contact(request):
    if request.method == 'POST': # If the form has been submitted...
        form = ContactForm(request.POST) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            ...
            send_mail(subject, message, sender_email, recipients)
            return HttpResponseRedirect('/thanks/') # Redirect after POST
    else:
        form = ContactForm() # An unbound form
    return render_to_response('contact.html', RequestContext(request,{'form': form}))

I keep getting emails from django about broken INTERNAL links which I can't explain:

Referrer: http://www.emetor.com/forum/
Requested URL: /thanks/forum/
User agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
IP address: xxx.xxx.xxx.xxx

It seems that they are due to a contact form on the referrer page, which after successful submission redirects to http://www.emetor.com/thanks/. When I try a contact submission, everything works just fine. But I'm afraid that I might miss some contact submissions!

Somebody who has an explanation about where the problem could be? Please let me know if you need further information...


The contact form does the following:

<form action="/contact/" method="post">

And in the view for contact:

def contact(request):
    if request.method == 'POST': # If the form has been submitted...
        form = ContactForm(request.POST) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            ...
            send_mail(subject, message, sender_email, recipients)
            return HttpResponseRedirect('/thanks/') # Redirect after POST
    else:
        form = ContactForm() # An unbound form
    return render_to_response('contact.html', RequestContext(request,{'form': form}))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

马蹄踏│碎落叶 2024-11-22 12:23:17

日志文件显示请求的 url 是“/thanks/forum/”,尽管您提到成功提交重定向是“/thanks”,因此请检查创建重定向 url 的代码。

其他解释可能是该链接是由某些爬虫或机器人保存的,并且它尝试请求该页面。

Log file shows that requested url is "/thanks/forum/", although you mention that successful submission redirect is "/thanks", so check the code where redirect url is created.

Other explanation could be that this link is saved by some crawler or bot and it try to request that page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文