访问要重写的地址时出现错误 403

发布于 2024-09-18 07:23:55 字数 946 浏览 3 评论 0原文

我有以下重写规则:

RewriteRule ^products/([a-zA-Z]+)$ /project/clients/index.php?database=$1&module=products [L,QSA]

目录结构是:

/var/www/project/clients/index.php

当写入地址时 "http://host/products/clientA/" 被定向到 "/project/clients/index.html 中。 php?database=clientA&module=products"。在我的 PC 上装有 linux (debian) 的虚拟机中工作正常,但服务器 linux 返回 403 错误。

但是如果我改写这个规则:

RewriteRule ^project/products/([a-zA-Z]+)$ /project/clients/index.php?database=$1&module=products [L,QSA]

然后写url:"http://host/project/products/clientA/",效果很好

"/var/www 上的权限/project/" 和子目录,适合 apache。

谢谢。

编辑 我将问题提交给“http://serverfault.com

初始问题

I have the following rewrite rules:

RewriteRule ^products/([a-zA-Z]+)$ /project/clients/index.php?database=$1&module=products [L,QSA]

The directory structure is:

/var/www/project/clients/index.php

When writing the address "http://host/products/clientA/" is directed into the "/project/clients/index.php?database=clientA&module=products". In my virtual machine with linux (debian) in my PC works fine, but the server linux returns a 403 error.

But if I switch to rewrite this rule:

RewriteRule ^project/products/([a-zA-Z]+)$ /project/clients/index.php?database=$1&module=products [L,QSA]

and then write the url: "http://host/project/products/clientA/", works well

The permissions on "/var/www/project/" and sub directories, is right for apache.

Thanks.

EDIT
I took my question to "http://serverfault.com"

initial question

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情泪▽动烟 2024-09-25 07:23:55

您应该将 .htaccess 文件放在 docroot 目录(public_html 或 htdocs)中。
示例:
网址:http://example.com/somedir/somefile.php
路径:/var/www/example/htdocs/somedir/somefile.php
.htaccess 应放置在 /var/www/example/htdocs/.htaccess 中。

当您收到 HTTP 403(或 500)错误时,您应该首先查看错误日志。

You should put the .htaccess file in the docroot directory (public_html or htdocs).
Example:
URL: http://example.com/somedir/somefile.php
Path: /var/www/example/htdocs/somedir/somefile.php
.htaccess should be placed in /var/www/example/htdocs/.htaccess.

When you get a HTTP 403 (or 500) error, you should look in your error logs first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文