静态站点 apache 和动态/成员站点 django
我有一个静态内容网站,所有运行在 apache 上的网站都可以访问。作为其附属,有一个在 django 上运行的会员站点。我在“共享”我的 .css 并使双方在外观上相同方面没有遇到任何问题,但我似乎不太明白的是让我的 django 站点受到 django 密码保护(附加警告,所有成员材料,从登录开始,经过 443)。
我可以为所有页面提供服务,我尝试使用 mod_rewrite 如下:
<Directory /Library/Webserver/Documents>
.
.
.
</Directory>
WSGIScriptAlias /members /usr/local/django/mysite/apache/django.wsgi
<Directory /members>
RewriteCond %{HTTPS} off
RewriteRule (.*) https://{HTTP_HOST}%{REQUEST_URI} [L]
.
.
</Directory>
我已经尝试了上面 '/members 位置中一千个不同项目中的每一个,似乎没有任何内容(是的,包括 RewriteEngine On - 我可以观看调试出来了)。
I have a site for static content, accessible to all that runs on apache. As an adjunct to that, there is a members site that runs on django. I haven't had any issue 'sharing' my .css and making both sides equivalent in appearance, but what I can't quite seem to grok is getting my django site to be django password protected (with the additional caveat that all member material, from the login forward, goes through 443).
I can serve all the pages, I have tried to use mod_rewrite as follows:
<Directory /Library/Webserver/Documents>
.
.
.
</Directory>
WSGIScriptAlias /members /usr/local/django/mysite/apache/django.wsgi
<Directory /members>
RewriteCond %{HTTPS} off
RewriteRule (.*) https://{HTTP_HOST}%{REQUEST_URI} [L]
.
.
</Directory>
I have tried every one of a thousand different items in the '/members location above, nothing seems to hit (and yes, RewriteEngine On is included - I can watch the debug come out).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
您应该重定向回请求所针对的同一主机,而不一定是实际的 Web 服务器主机。
我也不相信 mod_rewrite 中有 %{URI} 变量。应该使用%{REQUEST_URI}。
编辑 1
根据注释,应该是:
或:
因此,位置用于 URL,目录用于文件系统目录。
Try:
You should be redirecting back to same host the request was made against, not necessarily the actual web server host.
I also don't believe there is a %{URI} variable in mod_rewrite. Supposed to use %{REQUEST_URI}.
EDIT 1
As per comments, should be:
or:
So, Location is for URL and Directory is for file system directory.