I.e. you first give the pattern to match and then what it is rewritten to... however I'm not sure if you can actually match the GET parameters like this...
You have the wrong order... immediately after "RewriteRule" is the form of the URL that you want (ie. your clean url), with the Regex for whatever may change in that url. After that, you have the path of the URL, plus the Regex tokens for the found values (ie. $1, $2, etc.)
发布评论
评论(4)
如果您希望
/company.php?test=AAA001
重定向到/company/AAA001
,请执行以下操作:如果您希望
/company/AAA001
要重写为/company.php?test=AAA001
,请执行以下操作:If you want
/company.php?test=AAA001
to redirect to/company/AAA001
, do this:If you want
/company/AAA001
to be rewritten as/company.php?test=AAA001
, do this:我认为你的 RewriteRule 是以错误的方式编写的,有点倒退,它应该是
I.e.你首先给出要匹配的模式,然后将其重写为......但是我不确定你是否真的可以像这样匹配 GET 参数......
I think your RewriteRule is written in the wrong way, kind of backwards, it should be
I.e. you first give the pattern to match and then what it is rewritten to... however I'm not sure if you can actually match the GET parameters like this...
我不是 mod_rewrite 专家,但是:
不应该匹配这样的表达式:
并将它们映射到:
你的 URL 中只是:
Apache 日志说了什么?
你的 .htaccess 真的被读取了吗?
您重新加载 Apache 配置了吗? (不记得是否需要)
I'm not a mod_rewrite expert, but:
shouldn't match expressions like:
and map them into:
You have, in your URL, just:
What are the Apache logs saying?
Is your .htaccess actually read?
Did you reload the Apache configuration? (can't remember if it is needed)
您的顺序错误...紧接在“RewriteRule”之后的是您想要的 URL 形式(即您的干净 url),以及该 url 中可能发生更改的正则表达式。之后,您将获得 URL 的路径以及找到的值的正则表达式标记(即 $1、$2 等)
You have the wrong order... immediately after "RewriteRule" is the form of the URL that you want (ie. your clean url), with the Regex for whatever may change in that url. After that, you have the path of the URL, plus the Regex tokens for the found values (ie. $1, $2, etc.)