I've added this to my .htacces
:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
but then trying to reach www.example.com
redirects me to:
http://example.com/example/wsgi.py/
because i have WSGIScriptAlias / home/www/example.com/example/wsgi.py
directive in my httpd.conf
and of course i get 404 error.
Eventually, i've managed to fix this by adding next line in my urls.py
:
url(r'^example/wsgi.py/$', index),
(so it redirects to home page)
but i'm not quite sure that this is the right way to do it (because when i try to reach example.com
i see that web browser changes address quickly to www.example.com
and then again to example.com
)
If anyone would ask, yes i've seen this but this didn't help me either, because browser gets url recursive problem (example.com/example.com/example.com/example.com/example.com...)
EDIT : FOLDER STRUCTURE
This is my folder structure:
\mysite\
static\
media\
.htaccess
manage.py
mysite\
templates
templatetags
tinymce
static
urls.py
settigs.py
views.py
wsgi.py
models.py
forms.py
__init__.py