我收到以下消息时,我浏览到site.com无法使从site.com在Django域名重定向到www.site.com
500 - Internal Server Error
我让我的404错误信息,当我浏览到表明我的网站还活着的www.site.com。
你怎么能做出一个域名重定向没有通过的.htaccess从Django的到site.com www.site.com?
我的urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
(r'^home/', include('index.html')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)
[编辑]
我从Djangohosting如下回答:
Remove the website proxy for [site.com] and add [site.com] in the aliases section of the [www.site.com] website.
我不完全知道这意味着什么。
- 如何删除site.com的网站代理?
- 在哪里可以找到该网站www.site.com的别名部分?
为什么不能使用.htaccess(或者您可能使用的Web服务器提供的任何其他机制)? – mipadi 2009-04-12 17:20:55
@mipadi:我可以但我不想。我想学习配置我的网站没有.htaccess。有人告诉我,配置完整的.htaccess是Apache安全性不佳的一个标志。 – 2009-04-12 17:25:15
一般来说,Django不处理服务器配置 - 至少不是在这种情况下。 Django应用程序由服务器提供。所以如果你想自动从site.com重定向到www.site.com,某种类型的Apache配置文件是实现它的最好方式。 – mipadi 2009-04-12 17:27:45