站点地图中的错误网址

时间:2014-05-18 11:40:49

标签: django apache nginx django-sitemaps

我使用apache(端口8000)和nginx(端口80)来提供静态文件。现在我在sitemap.xml文件中看到,我看到的网址如下:

http://mysite:8000/slug

无法弄清楚为什么我得到它,因为在其他网站上我使用几乎相同的apache和nginx配置......并且站点地图代码看起来也很相似。 这是apache配置文件的内容:

<VirtualHost *:8000>
    ServerName mysite
    ServerAlias www.mysite

    DocumentRoot /var/www/mysite

    WSGIProcessGroup mysite
        WSGIScriptAlias / /var/www/mysite/myapp/wsgi.py
        WSGIDaemonProcess mysite \
                python-path=/home/dmitry/.virtualenv/myapp/lib/python2.7/site-packages 

    <Directory />
        AllowOverride None
        Order Deny,Allow
        Deny from all
        <Files robots.txt>
            Order deny,allow
            Allow from All
        </Files>
    </Directory>

    <Directory /var/www/mysite/myapp>
                <Files wsgi.py>
                Order deny,allow
                Allow from All
                </Files>
                Order deny,allow
                Deny from All
        </Directory>


    <Directory /var/www/mysite/myapp/static>
        Order deny,allow
        Allow from All
    </Directory>

    Alias /static/ /var/www/mysite/myapp/static/
    Alias /robots.txt /var/www/mysite/robots.txt

    ErrorLog ${APACHE_LOG_DIR}/mysite.error.log

    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/mysite.access.log combined

</VirtualHost>

这是nginx配置:

server{
    listen 80;
    server_name mysite www.mysite;

    root /usr/share/nginx/www;
        index index.html index.htm;

    location /static {
        alias /var/www/mysite/myapp/static;
    }

    location /media {
        alias /var/www/mysite/myapp/media;
    }

    location / {
        proxy_pass http://mysite:8000;
    }
}

这对SEO有害吗?

更新 这是我用来生成站点地图的代码:

views.py

from django.contrib.sitemaps import Sitemap

class VideosSitemap(Sitemap):
    changefreq = 'monthly'
    priority = 0.5

    def items(self):
        return Video.objects.filter(is_published=True)

    def lastmod(self, obj):
        return obj.datetime_published

urls.py

sitemaps = {
    'videos': VideosSitemap,
}
urlpatterns = patterns('',
    ...
    url(r'^videos/sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    ...
)

0 个答案:

没有答案