On 3 July 2010 01:05, ALJ <[email protected]> wrote:
> I've set up a server so that all the non secure connections get
> redirected to port 443. However, I've since realised that this is
> overkill so I want to set up a redirect on only those that are for "/
> acounts".
>
> When I do this, it completely breaks the URLs so that the path to the
> ".wsgi" is included in the url.
>
> "https://www.mydomain.net/C:/www/mysite/pdbsite/apache/django.wsgi/
> accounts/login/"
>
> Can anyone suggest what I'm doing wrong?
>
> --------------------------------------------------------------------------
> <VirtualHost 123.123.123.123:80>
>
>   DocumentRoot "C:/www/mydomain/pdbsite/main/site_media"
>
>        #Make sure that all connections to the admin and accounts dirs
> are secure
>        <Location /accounts>
>            RewriteEngine On
>            RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [QSA,NC,R,L]
>        </Location>

Instead of that whole location block, you could just use:

  Redirect /accounts https://www.example.com/accounts

where 'www.example.com' is replaced with your site name.

There shouldn't be a need to use mod_rewrite unless your host is
accessed via multiple host aliases and you need to ensure that
redirect uses the original host name.

Using mod_rewrite for simple redirects is an abuse of mod_rewrite.

Graham

>        #Aliases ---------------------
>        ...
>        Alias /media "C:/Python26/Lib/site-packages/django/contrib/
> admin/media"
>        WSGIScriptAlias / "C:/www/mysite/pdbsite/apache/django.wsgi"
>
>       ...
> </VirtualHost>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to