访问要重写的地址时出现错误 403
我有以下重写规则:
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"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将 .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.