1
我想將所有頁面請求重定向到另一個域,但排除一些我想單獨重定向的請求URI。所以我試過這樣的事情:如何從重定向中排除請求URI?
RewriteCond %{REQUEST_URI} !^/index.php?id=132$ [NC,OR]
RewriteCond %{REQUEST_URI} !^/index.php?id=133$ [NC]
RewriteRule .* https://new-domain.com/? [R=301,L]
Redirect 301 /index.php?id=132 https://new-domain.com/example
Redirect 301 /index.php?id=133 https://new-domain.com/example2
但是,這不工作,有人可以告訴我什麼是錯的?
作品像一個魅力,謝謝:) – Fox
但你能告訴我爲什麼它不起作用,如果我添加一些其他條件,如: RewriteCond%{THE_REQUEST}!/ index \ .php \?id = 13 [ [NC,OR] RewriteCond%{THE_REQUEST}!/ index \ .php \?id = 41 [&\ s] [NC] ... 看起來第一個條件是還在工作,但第二個條件是不工作:(。 – Fox
由於這是否定,你需要從你的條件'或'。 – anubhava