[Answered ]-How do I rewrite properly django and osqa htaccess to non www

2👍

That would only redirect the user back to the home page. Do this, it will keep everyone where they want to go. www to non-www:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule osqa.wsgi/(.*)$ http://domain.com/$1 [L,R=301]

If you want non-www to www Google it or just adjust line 3 and 4 to be like this example in reverse. domain.com should be your domain name.

👤LeviXC

0👍

Remove the “$1” argument from the last line. What this rule says is:
“When the host matches www.(anything)”
“Rewrite (the path part of the url) to http://(anything)/(the path part of the url)”
Where (anything) ends up as %1, and (the path part of the url) ends up as $1. So just remove the $1.

Leave a comment