0

我有以下重定向:

RewriteCond %{REQUEST_URI}  ^/index\.php$
RewriteCond %{QUERY_STRING} ^id=409$
RewriteRule ^(.*)$ http://www.domain.eu/index.php\?id=4 [R=301,L]


RewriteCond %{REQUEST_URI} foo_Bar\.pdf$ [NC]
RewriteRule ^(.*)$ http://www.domain.eu/index.php\?id=4 [R=301,L]

第一个工作正常。但是第二个没有指示,当我打开这个 url 时:(domain.eu/fileadmin/images/foo_Bar.pdf改为显示 404,这就是我要重定向的原因)。

我也尝试^(.*)在文件名之前添加一个,但它也不起作用。我什至尝试输入完整的 url 作为请求 uri,但不走运。我错过了什么?

谢谢

4

1 回答 1

1

它将重定向www.yourdomain.com/index.php?id=409http://www.domain.eu/index.php?id=4

如果您的站点地址以重定向结尾,则第二个将.foo_Bar.pdf重定向http://www.domain.eu/index.php?id=4

您需要将第二个更改为:

RewriteCond %{REQUEST_URI} foo_Bar\.pdf$ [NC]
RewriteRule ^(.*)$ http://www.domain.eu/index.php\?id=4 [R=301,L]
于 2013-07-23T14:24:47.853 回答