由网友(被海水咸死的鱼)分享简介:我想重定向http://www.example.com/component ?/工厂/视图=植物放;植物ID = 477 至http://www.example.com/component/plant/?view =工厂和ID = 477 我需要从URL最后删除字厂。我试过,但没有得到正确的结果。I need...
我想重定向
http://www.example.com/component ?/工厂/视图=植物放;植物ID = 477 至 http://www.example.com/component/plant/?view =工厂和ID = 477
我需要从URL最后删除字厂。 我试过,但没有得到正确的结果。
I need to delete word plant from the url last. I tried this but didnt get the proper result
RewriteEngine On
# Capture (d+) into %1
RewriteCond %{QUERY_STRING} plant-id=(d+) [NC]
# And rewrite (redirect) into id=%1
RewriteRule ^(.*)$ /component/plant/?view=plant&$1?id=%1 [L,R=301]
但它不是我的正常工作,任何帮助,请。
But its not work fine for me , any help please.
感谢
推荐答案
这应该为你工作:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(view=plant)&plant-id=([0-9]*)(?:&|$) [NC]
RewriteRule ^(component/plant)/?$ /$1/?%1&id=%2 [L,NC,R=301]
相关推荐
最新文章