RewriteEngine On
RewriteRule ^robots\.txt$ /static/robots.txt [L]

I think that should work if you have a web served folder of /static

I forget if DH supports Alias

because

Alias robots.txt /path/to/robots.txt will also work.


On Feb 14, 1:24 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I'm using a shared server at Dreamhost, which limits my access to
> certain things. :(
>
> How can I do this with mod_rewrite?
>
> On Feb 14, 4:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > If you are using Apache(or probably other servers as well), the best
> > way to do it would be  to just let your web server serve it up, Apache
> > can be set to cause files with certain extensions to be served up as
> > usual instead of going through django(this is instead of/in addition
> > to the usual way of doing it by directory), there is a guide to doing
> > this somewhere, does anyone know the URL?
>
> > On Feb 14, 2:35 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > > I use something like this:
>
> > >   (r'^robots.txt$',         'django.views.static.serve', { 'path' : "/
> > > txt/robots.txt",
>
> > > 'document_root': settings.MEDIA_ROOT,
>
> > > 'show_indexes': False } ),
>
> > > On Feb 14, 10:53 pm, "[EMAIL PROTECTED]"
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > I built a Django site for my blog and want to serve a robots.txt file
> > > > for it. But I can't figure out how to go about doing this since it's a
> > > > static file.
>
> > > > Here is what I have in my urls:
>
> > > > from patrickbeeson.views import robots
> > > > ...
> > > > (r'^robots.txt$', robots),
>
> > > > From the views:
>
> > > > from django.http import HttpResponse
> > > > from django.template import TemplateDoesNotExist
>
> > > > def robots(request):
> > > >         try:
> > > >                 return HttpResponse(open('robots.txt').read(), 
> > > > 'text/plain')
> > > >         except TemplateDoesNotExist:
> > > >                 raise Http404()
>
> > > > The "robots.txt" file is located in my templates directory with other
> > > > templates.
>
> > > > Any suggestions on what I might be doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to