.htaccess带有问号的重定向

时间:2018-07-13 02:17:45

标签: .htaccess redirect

我正在尝试通过.htaccess重定向此URL

http://www.deguate.com/foros/showthread.php?874-Soy-de-Guatemala-y-quiero-dar-a-mi-bebe-en-adopcion

对此:

https://www.deguate.com/artman/publish/mujer-actualidad/Soy-de-Guatemala-quiero-dar-mi-bebe-adopcion.shtml

我尝试了很多选择,但似乎没有任何效果,例如:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^foros\/showthread\.php\?874\-Soy\-de\-Guatemala\-y\-quiero\-dar\-a\-mi\-bebe\-en\-adopcion$ "https\:\/\/www\.deguate\.com\/artman\/publish\/mujer\-actualidad\/Soy\-de\-Guatemala\-quiero\-dar\-mi\-bebe\-adopcion\.shtml" [R=301,L]

1 个答案:

答案 0 :(得分:1)

您可以使用以下规则:

RewriteEngine on

RewriteCond %{QUERY_STRING} ^(874-Soy-de-Guatemala-y-quiero-dar-a-mi-bebe-en-adopcion)$
RewriteRule ^foros/showthread\.php$ https://www.deguate.com/artman/publish/mujer-actualidad/%1? [L,R]