当前位置: 动力学知识库 > 问答 > 编程问答 >

django - the site has a redirect loop error while visiting site

问题描述:

Am working on a certain django site.

wherever i go to url [1]: http://www.justsaidyes.net I get an error "This webpage has a redirect loop"

Any one who has encountered similar error before please help

My htaccess code looks like below if it should help you help me

RewriteEngine on

RewriteCond %{HTTP_HOST} ^justsaidyes\.net$ [OR]

RewriteCond %{HTTP_HOST} ^www\.justsaidyes\.net$

RewriteRule ^/?$ "http\:\/\/www\.justsaidyes\.net\/" [R=301,L]

网友答案:

I guess you probably have something in your webserver config redirecting in this way (for example) :

www.justsaidyes.net -> justsaidyes.net
justsaidyes.net -> www.justsaidyes.net

Something like that. If you show more relevant code (maybe some configs?), we could help more ^^.

EDIT : After looking at your website with Firebug, it seems you are redirecting http://www.justsaidyes.net to ... http://www.justsaidyes.net.

EDIT2 (aftermore code provided) : You can remove your htaccess file. Django isn't meant to be deployed this way. You have to create a host file in sites-available like described here : https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/.

Then "activate" this website by running a2ensite NameOfTheFileYouCreated.

If you want to write redirect rules, you can do it directly in the host. But I don't think you want to do this according to your htaccess, so I guess this would be enough :

ServerName justsaidyes.net
ServerAlias www.justsaidyes.net

And btw, your htaccess creates a loop, you redirect http://justsaidyes.net(3rd line) and http://www.justsaidyes.net(4th line) to http://www.justsaidyes.net(5th line). Remove the 4th line and you shouldn't have it again.

分享给朋友:
您可能感兴趣的文章:
随机阅读: