I'm attempting to setup a URL redirect for any Q&A site I'm establishing for Boat Repairs. I would like boatrepaired.com to visit www.boatrepaired.com. I'm generally a php guy and so i am a little wrongly identified as python etc. utilized by OSQA. I added this to my apache conf file...

<Directory /opt/OSQA/>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^boatrepaired\.com [NC]
RewriteRule ^(.*)$ http://www.boatrepaired.com/$1 [L,R=301]

It somewhat functions by delivering boatrepaied.com to ... www.boatrepaired.com/osqa.wsgi/

Basically remove from the $1 online 5 it really works perfect except it redirects everybody to the leading page. Any help could be appreciated.



OSQA is dependant on Django, and Django can instantly do that for you personally (I think this really is enabled for OSQA automatically).

Otherwise, add this setting for your Django configurations module:

If PREPEND_WWW holds true, Web addresses that lack a number one “www.” is going to be rerouted towards the same URL having a leading “www.”leading “www.”

And make certain the django.middleware.common.CommonMiddleware is enabled.

Why don't you fix this entirely in apache:

<VirtualHost ..>
    ServerName boatrepaired.com

    Redirect permanent / http://www.boatrepaired.com/ 

<VirtualHost ..>
    ServerName www.boatrepaired.com

    ... basic wsgi / django config ...

So separate vhosts for domain names, with permanent redirects in the "wrong" someone to the most appropriate one. It is useful for all pathways inside the domain, not only /