Apache2用户文件访问mod_rewrite

发布于 2024-12-16 01:56:07 字数 609 浏览 0 评论 0原文

最近,我们学校不得不将我们的在线存储从异地提供商转移到我们学校内的服务器。但我们仍将使用他们的服务器来进行在线课程,只是文件将被移动。

我想要的是,当学生登录到场外服务器并单击一个链接,将他们定向到我们服务器上的文件(即作业.pdf)时,他们将看到一个登录窗口,然后才能获得文件。他们的会议将被记住。

我已经设置了一个带有 Apache2 的 SUSE11 服务器,并且有一个使用 php 和 mysql 的工作登录系统,但它只是加载一个 php 文件,该文件为我提供了他们可以下载的文件列表。我们的院长希望服务器只向他们提供他们单击的文件。

我尝试过使用 mod_rewrite 但每次尝试都失败。 我们的想法是让服务器将学生请求重定向(通过 mod_rewrite)到 login.php 文件并检查会话以查看他们是否已经登录,然后他们必须登录才能访问他们的文件,或者他们是否已经登录将他们重定向到他们请求的文件。我们似乎不断收到无限环回或永远找不到文件。

我在 virtual.d 文件夹中创建了一个虚拟主机conf 文件,并且我一直将重写语句存储在那里。我认为这是正确的位置。

有人可以帮忙吗?
我是一名 Netware 老用户(20 岁),迁移到全 Linux 环境并不容易。

谢谢, 戴夫

Recently our school is having to move our online storage from an offsite provider to a server within our school. But we will still be using their server for our online courses, just the files will be moved.

What I would like is when the student is logged into the offsite server and they click on a link that is directing them to a file on our server (i.e. assignment.pdf) they will then be presented with a login window before they can get the file. And their session will be remembered.

I have setup a SUSE11 server with Apache2 and have a working login system that uses php and mysql but it simply loads a php file that gives me a list of files they can download. Our dean wants the server to just give them the file they clicked on.

I have tried to use mod_rewrite but I keep failing at every attempt.
Our Idea was to have the server redirect (through mod_rewrite) the students request to a login.php file and check the session to see if they have already logged in, then they have to either login to access their file or if they already have logged in redirect them to the file they requested. We seem to keep getting infinite loopbacks or the file is never found.

I have a virtual host conf file created in the virtual.d folder and I have been storing the rewrite statements there. I assume that this is the correct location.

Could someone please help?
I am an old Netware user (20 years) moving to an all Linux enviroment it hasn’t been easy.

Thanks,
Dave

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文