B
B
blazer052017-05-13 17:21:20
Django
blazer05, 2017-05-13 17:21:20

How to setup .htaccess on django?

Hello.
Need help setting up .htaccess. The problem is that now, after adding some directives to .htaccess, when the site is loaded, such a site address is displayed in the address bar of the browser.
https://mysite.ru/django.wsgi/
This appeared after I added these lines.
RewriteCond %{HTTP:X-Forwarded-Protocol} !=https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
These redirect rules are needed, but without them the site address looks fine after loading .
How can this be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
blazer05, 2017-07-07
@blazer05

AddHandler wsgi-script .wsgi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /django.wsgi/$1 [QSA,PT,L]
in settings.py add this
# Redirect to https://
SECURE_SSL_REDIRECT=True

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question