开发者

Error 403 when accessing an address to rewrite

开发者 https://www.devze.com 2023-01-14 20:20 出处:网络
I have the following rewrite rules: RewriteRule ^products/([a-zA-Z]+)$ /project/clients/index.php?database=$1&module=products [L,QSA]

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 (debia开发者_运维知识库n) 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消