1

Here is my rule:

RewriteRule ^forward/?$ forward.php?url=$1 - [NC,L]

This is what I would like:

Browser URL: http://mydomain.com/forward/http://anydomainhere.com

Rewritten to: http://mydomain.com/forward.php?url=http://anydomainhere.com

This will be the last rule evaluated if a match is made. Right now it gives me a 500 error and I can't figure out why.

4

3 回答 3

0

从重写规则中删除连字符,它应该可以工作:

RewriteRule ^forward(/.*)?$ forward.php?url=$1   [NC,L]
于 2013-09-05T17:10:25.900 回答
0

错误 500 通常意味着服务器配置错误,在您的情况下是重写规则。您通常可以在 Apache 的错误日志中查找有关到底发生了什么的详细信息。在您的情况下,您的重写规则似乎在语法上是错误的。

这对我有用:

RewriteRule ^forward/(.*)$ forward.php?url=$1 [NC,L]
于 2013-09-05T17:14:27.380 回答
0

您不能使用它RewriteRule来捕获 URL,//因为它已被 Apache 精简为一个/ReeriteCond改为使用%{THE_REQUEST}变量:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+forward/([^?\s]+) [NC]
RewriteRule ^ forward.php?url=%1 [L,NE,QSA]
于 2013-09-05T17:18:19.653 回答